systemd-analyze
Analyze system boot performance
TLDR
Print the last system startup time
List all running units, ordered by the time they took to initialize
Print a tree of the time-critical chain of units
Create an SVG file showing when each system service started, highlighting the time that they spent on initialization
Plot a dependency graph and convert it to an SVG file
Show security scores of running units
View all udev rules together
SYNOPSIS
systemd-analyze [OPTIONS...] {COMMAND} [UNIT...]
PARAMETERS
time
Prints the time spent in the kernel, initrd, and userspace during boot.
blame
Shows unit initialization times, ordered by the time they took.
critical-chain
Displays a tree of the most critical dependencies that slow down the boot process.
plot
Generates an SVG image showing the boot process time sequence. Requires Graphviz dot.
dot
Generates a dependency graph in Graphviz dot format. Requires Graphviz dot.
verify [UNIT...]
Checks the specified unit files for correctness and potential issues.
dump
Dumps the internal state of the systemd service manager.
log-level [LEVEL]
Gets or sets the systemd manager's log level (e.g., 'debug', 'info').
log-target [TARGET]
Gets or sets the systemd manager's log target (e.g., 'console', 'journal').
unit-paths
Lists the directories from which systemd loads unit files.
--user
Operates on the user's systemd instance instead of the system instance.
--system
Operates on the system-wide systemd instance (this is the default).
--json=[MODE]
Formats output as JSON (e.g., pretty, short, full).
DESCRIPTION
systemd-analyze is an essential command-line utility for understanding and optimizing the systemd system and service manager. It provides a suite of subcommands to inspect various aspects of system behavior, with a primary focus on boot-up performance. Users can identify bottlenecks by analyzing the time spent in the kernel, initrd, and userspace, or by listing services ordered by their initialization time. The command can also generate detailed graphical representations of the boot process, aiding in visual debugging. Beyond performance, systemd-analyze assists in verifying systemd unit files, examining service dependencies, and dumping the internal state of the service manager, making it an indispensable tool for system administrators and developers troubleshooting systemd-related issues or aiming to improve system startup efficiency.
CAVEATS
Requires systemd to be the active init system on the Linux distribution.
The plot and dot subcommands rely on Graphviz (the dot command) being installed for generating visual graphs; without it, these commands will not produce output.
Boot times reported by systemd-analyze can exhibit slight variations across different reboots due to factors like disk caching, kernel updates, or background system activities.
The blame output, while useful, primarily reflects sequential initialization times and might not fully capture the benefits of parallel execution or complex inter-service dependencies.
<B>BOOT PERFORMANCE VISUALIZATION</B>
The plot subcommand is particularly powerful for visualizing the entire boot sequence as an SVG image. This graphical representation makes it much easier to identify overlaps, gaps, and specific services contributing to delays, providing an intuitive understanding of boot performance bottlenecks.
<B>UNIT FILE DEBUGGING</B>
The verify subcommand is invaluable for developers and system administrators creating or modifying custom systemd unit files. It performs syntax checks and highlights potential errors or deprecated settings, helping to ensure units function correctly before deployment and preventing issues during system operation.
<B>JSON OUTPUT FOR SCRIPTING</B>
Many of systemd-analyze's subcommands support a --json output option. This allows for easy parsing of command output in scripts or automated tools, enabling advanced analysis and integration with monitoring systems and other programs that can consume structured data.
HISTORY
systemd-analyze emerged as a crucial utility alongside the development and widespread adoption of systemd, which began replacing the traditional SysVinit system in many major Linux distributions starting in the early 2010s. Its primary purpose was to provide visibility into the new, often complex, dependency-based boot process managed by systemd. Over time, its functionalities expanded from basic boot time reporting to sophisticated tools for dependency visualization, unit file validation, and detailed internal state inspection, reflecting the growing needs of administrators managing systemd-powered systems.
SEE ALSO
systemctl(1), journalctl(1), bootctl(1), graphviz(1)