systemd Commands Cheat Sheet
Get the cheat sheet
The systemd service runs on Linux to consolidate service configuration and application behavior: starting, stopping, and so forth. systemd is found in Red Hat Enterprise Linux as well as other Linux distributions.
Users and administrators query and control systemd behavior through the systemctl command. This systemd Cheat Sheet presents the most common uses of systemctl, along with journalctl for displaying information about systemd activities from its logs.
Topics in this Cheat Sheet include:
- systemctl enable
- systemctl restart
- systemctl start
- systemctl status
- systemctl stop
Control over computers and virtual machines
- systemctl poweroff
- systemctl reboot
- systemctl list-sockets
- systemctl list-units
- systemctl list-unit-files
The systemctl command in this example stops the httpd service. This command can be useful if you have to stop a service in order to back up its data, because you think it is being attacked by a malicious intruder, or for any other reason. The systemctl status httpd command that follows reports the status.
$ systemctl stop httpd $ systemctl status httpd httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: inactive (dead) since Mon 2022-01-24 09:56:53 PST; 3s ago Docs: man:httpd.service(8) Process: 1262 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS) Main PID: 1262 (code=exited, status=0/SUCCESS) Status: "Running, listening on: port 80" Jan 24 09:32:27 localhost.localdomain systemd: Starting The Apache HTTP Server... Jan 24 09:32:34 localhost.localdomain httpd: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, usi> Jan 24 09:41:29 localhost.localdomain systemd: Started The Apache HTTP Server. Jan 24 09:41:29 localhost.localdomain httpd: Server configured, listening on: port 80 Jan 24 09:56:52 localhost.localdomain systemd: Stopping The Apache HTTP Server... Jan 24 09:56:53 localhost.localdomain systemd: httpd.service: Succeeded. Jan 24 09:56:53 localhost.localdomain systemd: Stopped The Apache HTTP Server.
Note the following line in the status output, which shows that the httpd service is inactive:
Active: inactive (dead) since Mon 2022-01-24 09:56:53 PST; 3s ago