Managing Services with systemd | Start Stop and List Services

By | 2014/03/07

Managing services with systemd is very straightforward. Since the major Linux distros are all going with systemd, managing services will be the same across those Linux distros. Here is a quick how-to!

Start or Stop a Service

$ sudo systemctl start cups

$ sudo systemctl stop cups

Check the Status of a Service

$ sudo systemctl status sshd
sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: active (running) since Fri 2014-03-07 16:16:08 UTC; 22min ago
 Main PID: 584 (sshd)
   CGroup: /system.slice/sshd.service
           └─584 /usr/sbin/sshd -D

Mar 07 16:16:08 localhost systemd[1]: Started OpenSSH server daemon.
Mar 07 16:16:08 localhost sshd[584]: Server listening on port 22.
Mar 07 16:16:08 localhost sshd[584]: Server listening on :: port 22.
Mar 07 16:16:43 localhost sshd[591]: Accepted password for bob from port 37467 ssh2
Mar 07 16:16:43 localhost sshd[591]: pam_systemd(sshd:session): Ignoring vtnr 0 for  which is not seat0
Mar 07 16:22:47 localhost sshd[7292]: Did not receive identification string from

Enable a Service at Boot

$ sudo systemctl enable sshd
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/'

Disable a Service From Starting at Boot

$ sudo systemctl disable cups
rm '/etc/systemd/system/'
rm '/etc/systemd/system/'
rm '/etc/systemd/system/'

List Services and Their Status

$ systemctl list-unit-files


$ sudo systemctl

For more, the fedora and arch wikis have great pages:

2 thoughts on “Managing Services with systemd | Start Stop and List Services

  1. docent

    Great post 🙂 I’d add some more here:

    – systemd-cgls – show cgroup tree
    – systemctl get-default – what is the default target (runlevel)?
    – change boot target (runlevel):
    – ln -sf /usr/lib/systemd/system/ /etc/systemd/system/ (like runlevel 3)
    – ln -sf /usr/lib/systemd/system/ /etc/systemd/system/ (like runlevel 5)
    – systemctl isolate – change current target (runlevel); no effect after reboot
    – systemctl list-units –type=target – what is the current target (runlevel)?
    – systemctl show -p “Wants” – show target’s dependencies (could also try with “WantedBy”, “Requires”, “RequiredBy”, “Conflicts”,”ConflictedBy”, “Before”, “After”)
    – systemd –test –system – – check what would get started after booting into specific boot target
    – alias psc=’ps xawf -eo pid,user,cgroup,args’ – alias for ps with cgroups

  2. DevOps

    The information which you have provided is very good and easily understood.


Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.