#Introduction
In this tutorial, I write about the Systemd cheat sheet useful in Linux. Systemd provides a system and service that runs at PID 1. It tracks logged-in users and running containers and virtual machines and more.
Logs with systemd
The content | Command Line |
View all system logs | journalctl |
List boot numbers | journalctl –list-boots |
View logs for unit ssh | journalctl –unit ssh |
View system logs from the most recent | journalctl -xe |
For example the picture below


Introspection with systemd
The content | Command Line |
show unit file settings | systemctl show sshd |
Show contents of the unit file | systemctl cat sshd |
Show whether the unit is active | systemctl is-active sshd |
Show whether the unit has failed | systemctl is-failed sshd |
Edit unit file configuration | sudo systemctl edit sshd |
Restart daemon | sudo systemctl daemon-reload |
Services
The content | Command Line |
Start service nginx | systemctl start nginx |
Stop service nginx | systemctl stop nginx |
Show status of service nginx | systemctl status nginx |
Start nginx now and at system startup | systemctl enable –now nginx |
At system startup, start (enable) nginx | systemctl enable nginx |
At system startup, do not start nginx | systemctl disable nginx |
Show whether service nginx is enabled | systemctl is-enabled nginx |
Prevent service from starting (mask) | systemctl mask nginx |
Unmask service, allowing it to be started | systemctl unmask nginx |
List all available services | systemctl list-unit-files –-type service |
For example as below


Targets (runlevels)
The content | Command line |
List all available targets | systemctl list-unit-files –-type target |
Show dependencies of a target | systemctl list-dependencies nginx |
Show default boot target | systemctl get-default |
Boot to a text console | systemctl set-default multi-user |
Boot to a graphical desktop | systemctl set-default graphical |

Conclusion
You have to use Systemd Cheat Sheet Useful in Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!