\documentclass[a4paper]{article} \usepackage[table]{xcolor} \usepackage{tabularx} \usepackage[ citecolor=red,backref,bookmarks, pdfpagemode=None, pdftitle={Systemd Cheatsheet}, pdfauthor={PetrR}, pdfsubject={Systemd Cheatsheet}, pdfkeywords={Systemd Cheatsheet, Refcard, Cheat Sheet, Systemd}, pdfview=FitB ]{hyperref} \title{Systemd Cheatsheet} \pagestyle{empty} \addtolength{\voffset}{-3.5cm} \addtolength{\textheight}{7cm} \addtolength{\hoffset}{-3.7cm} \addtolength{\textwidth}{7.4cm} % ----------------------------------------------------------------------- \begin{document} \begin{center} {\huge Systemd Cheatsheet} \vspace{7mm} \small \begin{tabularx}{\textwidth}{ |l|X|X| } \hline \rowcolor[gray]{.8} \bfseries Sysvinit Command & \bfseries Systemd Command & \bfseries Notes \\\hline \tt service httpd start & \tt systemctl start httpd.service & Used to start a service (not reboot persistent) \\\hline \tt service httpd stop & \tt systemctl stop httpd.service & Used to stop a service (not reboot persistent) \\\hline \tt service httpd restart & \tt systemctl restart httpd.service & Used to stop and then start a service \\\hline \tt service httpd reload & \tt systemctl reload httpd.service & When supported, reloads the config file without interrupting pending operations \\\hline \tt service httpd condrestart & \tt systemctl condrestart httpd.service & Restarts if the service is already running \\\hline \tt service httpd status & \tt systemctl status httpd.service & Tells whether a service is currently running \\\hline \tt service --status-all & \tt systemctl list-units --type service & Displays the status of all services \\\hline \tt ls /etc/rc.d/init.d/ & \tt systemctl list-unit-files --type=service & Used to list the services that can be started or stopped; Used to list all the services and other units \\\hline \tt chkconfig httpd on & \tt systemctl enable httpd.service & Turn the service on, for start at next boot, or other trigger \\\hline \tt chkconfig httpd off & \tt systemctl disable httpd.service & Turn the service off for the next reboot, or any other trigger \\\hline \tt chkconfig httpd & \tt systemctl is-enabled httpd.service & Used to check whether a service is configured to start or not in the current environment \\\hline \tt chkconfig --list & \tt systemctl list-unit-files --type=service \newline ls /etc/systemd/system/*.wants/ & Print a table of services that lists which runlevels each is configured on or off \\\hline \tt chkconfig httpd --list & \tt ls /etc/systemd/system/*.wants/httpd.service & Used to list what levels this service is configured on or off \\\hline \tt chkconfig httpd --add & \tt systemctl daemon-reload & Used when you create a new service file or modify any configuration \\\hline \end{tabularx} \vspace{6mm} \begin{tabularx}{\textwidth}{ |l|l|X| } \hline \rowcolor[gray]{.8} \bfseries Sysvinit Runlevel & \bfseries Systemd Target & \bfseries Notes \\\hline 0 & runlevel0.target, poweroff.target & Halt the system \\\hline 1, s, single & runlevel1.target, rescue.target & Single user mode \\\hline 2, 4 & runlevel2.target, runlevel4.target, multi-user.target & User-defined/Site-specific runlevels - identical to 3 \\\hline 3 & runlevel3.target, multi-user.target & Multi-user, non-graphical; Users can usually login via multiple consoles or via the network \\\hline 5 & runlevel5.target, graphical.target & Multi-user, graphical; Usually has all the services of runlevel 3 plus a graphical login \\\hline 6 & runlevel6.target, reboot.target & Reboot \\\hline emergency & emergency.target & Emergency shell \\\hline \end{tabularx} \vspace{6mm} \begin{tabularx}{\textwidth}{ |l|X| } \hline \rowcolor[gray]{.8} \bfseries Command & \bfseries Notes \\\hline \tt systemctl get-default & Determine which target unit is used by default \\\hline \tt systemctl set-default multi-user.target & Change default boot target to multi-user.target \\\hline \tt journalctl -b & Show all messages from this boot \\\hline \tt journalctl -b -p err & Show all messages of priority levels ERROR (4) and worse, from the current boot \\\hline \tt journalctl -p warning --since='2014-06-14 23:59:59' & View the warning or higher priority messages from certain point in time \\\hline \tt journalctl -f & Follow new messages \\\hline \tt journalctl -u SERVICE & Show only log of SERVICE \\\hline \tt journalctl /usr/sbin/httpd & Show all messages by a specific executable \\\hline \tt journalctl --full & Display full (= not truncated) messages \\\hline \tt systemctl --state=failed & Lets find the systemd services which fail to start \\\hline \tt systemctl list-units --type=target & Show current runlevel \\\hline \tt systemctl isolate graphical.target & Changes the current target (runlevel) \\\hline \tt systemctl rescue/emergency & Changing to Rescue (single user mode)/Emergency Mode \\\hline \tt systemctl kill SERVICE.service & Kill SERVICE (all processes) with SIGTERM \\\hline \tt systemctl --failed & List failed services on boot \\\hline \tt systemd-cgls & cgroup tree \\\hline \tt systemctl show -p Wants multi-user.target & What other units does a unit depend on? \\\hline \tt systemctl list-jobs & Check for possibly stuck jobs use \\\hline \tt systemctl list-dependencies & Show units and it's dependencies \\\hline \end{tabularx} \vspace{6mm} \begin{tabularx}{\textwidth}{ |X|X|X| } \hline \rowcolor[gray]{.8} \bfseries Old Command & \bfseries Systemd Command & \bfseries Description \\\hline \tt halt & \tt systemctl halt & Halts the system \\\hline \tt poweroff & \tt systemctl poweroff & Powers off the system \\\hline \tt reboot & \tt systemctl reboot & Restarts the system \\\hline \tt pm-suspend & \tt systemctl suspend & Suspends the system \\\hline \tt pm-hibernate & \tt systemctl hibernate & Hibernates the system \\\hline \tt pm-suspend-hybrid & \tt systemctl hybrid-sleep & Hibernates and suspends the system \\\hline \end{tabularx} % Footer %\vfill \hrule\smallskip %{\tiny %This card may be freely distributed under the terms of the GNU general public license %} \end{center} \end{document}