Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

systemd-analyze

Analyze systemd: boot time, slow units, unit file errors, timer expressions and the security of services.

Niveau
Dagelijks Linux
Groep
Services en opstarten
Root nodig
Nee
Pakket
systemd

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

systemd-analyze shows how long the boot took (time), which units took the most time (blame) and which chain of units was the slowest (critical-chain). It also checks unit files for errors (verify), tests calendar expressions for timers (calendar) and rates the sandboxing of services (security).

Zo schrijf je het

systemd-analyze [OPTION]... [COMMAND] [ARGUMENT]...

Belangrijkste delen

time
Boot time in kernel, initrd and user space.
blame
Units sorted by start time.
critical-chain [UNIT]
The slowest chain of dependencies.
plot
SVG picture of the boot.
dot [PATTERN]
Dependency graph in dot format.
verify FILE...
Check unit files for errors.
security [UNIT]
Rate the security settings of services.
calendar SPEC...
Test an OnCalendar= expression.
timestamp TIME...
Parse a time stamp.
timespan SPAN...
Parse a time span.
cat-config NAME|PATH
Show a config file with all its drop-ins.
unit-paths
Folders where unit files are searched.
unit-files
List unit files and aliases.
condition CONDITION...
Test Condition=/Assert= lines.
exit-status [STATUS]
Exit status names and numbers.
capability [CAP]
Capability names and numbers.
syscall-filter [SET]
System call sets for SystemCallFilter=.
filesystems [SET]
File system sets.
dump
Full state of the manager (debug).
compare-versions V1 [OP] V2
Compare version strings.
inspect-elf, malloc, fdstore, image-policy, pcrs, srk
Special tools.

Opties 27

Meest gebruikt

--system
The system manager (default).
--user
The user manager.
--global
Global user settings.
--order, --require
With dot: only order or only need links.
--from-pattern=, --to-pattern=
With dot: filter the graph.
--fuzz=TIME
With critical-chain: also show units within this time.
--man=no
With verify: do not check man pages.
--generators
With verify: also run generators.
--recursive-errors=MODE
With verify: also check dependencies.
--threshold=N
With security: fail above this score.
--security-policy=PATH
With security: own policy file.
--offline=BOOL
With security: check the files, not the running units.
--profile=PATH
With security/verify: use a portable profile.
--iterations=N
With calendar: show N next times.
--base-time=TIME
With calendar: start from this time.
--unit=UNIT
With condition: use this unit.
--json=MODE
JSON output (pretty, short, off).
--table
Table output.
--no-legend
No header.
--root=PATH, --image=PATH, --image-policy=POLICY
Work on another root or image.
-H, --host=HOST
Remote host over SSH.
-M, --machine=NAME
A container.
-q, --quiet
Less output.
--tldr
With cat-config: without comments.
--no-pager
Do not use a pager.
-h, --help
Show help.
--version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1How long did the boot take?

    systemd-analyze
    Startup finished in 1.204s (kernel) + 2.810s (initrd) + 9.512s (userspace) = 13.527s
    multi-user.target reached after 9.480s in userspace.

    Same as systemd-analyze time.

  2. 2Which units are slow?

    systemd-analyze blame | head

    Units that start in parallel can still look slow here.

  3. 3The slowest chain

    systemd-analyze critical-chain

    The real reason for a slow boot.

  4. 4Check a unit file for errors

    systemd-analyze verify /etc/systemd/system/hello.service

    Shows typos and unknown settings before you start it.

  5. 5Test a timer expression

    systemd-analyze calendar --iterations=3 'Mon..Fri 02:30'

    Shows the next 3 run times.

  6. 6Rate service security (DevSecOps)

    systemd-analyze security
    systemd-analyze security httpd.service

    Lists missing hardening settings with a score.

  7. 7Fail a CI check on weak settings

    systemd-analyze security --offline=true --threshold=5 ./myapp.service

    Exit code not 0 when the score is above 5.

  8. 8Picture of the boot

    systemd-analyze plot > boot.svg

    Open it in a browser.

  9. 9See a config with all drop-ins

    systemd-analyze cat-config systemd/journald.conf

    The real settings, from all files.

  10. 10Time spans and exit codes

    systemd-analyze timespan 1h30m; systemd-analyze exit-status 203

    203 = EXEC: the program in ExecStart could not be run.

Exitcodes

0 :: Done. 1 :: Error (also verify problems or a score above --threshold).

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man systemd-analyze