Skip to content

Instantly share code, notes, and snippets.

@tbotalla
Last active April 14, 2020 06:14
Show Gist options
  • Save tbotalla/69b2b0d60dad4292a349b6516f26cf0b to your computer and use it in GitHub Desktop.
Save tbotalla/69b2b0d60dad4292a349b6516f26cf0b to your computer and use it in GitHub Desktop.
Systemd commands on Linux
  • View all services
systemctl 

systemctl list-units --type=service
OR
systemctl --type=service
  • View active services
systemctl list-units --type=service --state=active
OR
systemctl --type=service --state=active
  • View running services
# systemctl list-units --type=service --state=running 
OR
# systemctl --type=service --state=running
  • Delete a Service
systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename] 
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related
systemctl daemon-reload
systemctl reset-failed

# It is possible that the systemd service 'wraps' the old style scripts in /etc/init.d, so you may want to clean that up too, but that is not where systemd services live.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment