The systemd-analyze command is used to retrieve performance statistics for boot operations. The command takes one or more subcommands that determine what type of information to print, and how. For process management and troubleshooting, blame is the most relevant subcommand. This will print a list of all systemd units that were executed at boot, along with the time it took each unit to execute. You can use systemd-analyze blame to identify services and other units that make the system slow to boot.
Syntax
The syntax of the systemd-analyze command is:
# systemd-analyze [options] [subcommand]
If you encounter the below error while running the systemd-analyze command:
systemd-analyze: command not found
you may try installing the systemd package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install systemd |
Ubuntu | apt-get install systemd |
Arch Linux | pacman -S systemd |
Kali Linux | apt-get install systemd |
CentOS | yum install systemd |
Fedora | dnf install systemd |
Raspbian | apt-get install systemd |
systemd-analyze Command Examples
1. List time of each unit to start up:
# systemd-analyze blame
2. Print a tree of the time-critical chain of units:
# systemd-analyze critical-chain
3. Create an SVG file showing when each system service started, highlighting the time that they spent on initialization:
# systemd-analyze plot > path/to/file.svg
4. Plot a dependency graph and convert it to an SVG file:
# systemd-analyze dot | dot -Tsvg > path/to/file.svg
5. Show security scores of running units:
# systemd-analyze security