SystemCTL Cheat Sheet

Published: 2018-04-04 09:03:07 +0000
Categories: BASH,




Whether or not you like SystemD it is a reality of the world we currently live in, and anyone managing a modern operating system is likely to have a need to interact with it.

Utilities such as service,ckconfig and update.rc-d have largely been replaced with systemctl and it's syntax isn't always as simple and intuitive - especially when you're used to the other ways of doing things

Similar to

  • chkconfig
  • service
  • update-rc.d


## Interacting with services

# Start service foo
# equiv: service foo start
systemctl start foo

# Stop service foo
# equiv: service foo stop
systemctl stop foo

# Restart service foo
# equiv: service foo restart
systemctl restart foo

# Reload service foo
# equiv: service foo reload
systemctl reload foo

# Conditional restart service foo
# equiv: service foo condrestart
systemctl condrestart foo

# Get status of service foo
# equiv: service foo status
systemctl status foo

## Managing services

# Disable service foo
# equiv: chkconfig foo off
systemctl disable foo.service

# Enable service foo
# equiv: chkconfig foo on
systemctl enable foo.service

# Check whether foo is enabled
# equiv: chkconfig foo
systemctl is-enabled foo.service

# Check what levels foo runs at
# equiv: chkconfig foo --list
ls /etc/systemd/system/*.wants/foo.service

## Checking runlevels and services

# List service unit files (what would have been init scripts)
# equiv: chkconfig --list
systemctl list-unit-files --type=service

# List services that run at runlevel 5 (graphical mode)
# equiv: chkconfig --list | grep 5:on
systemctl list-dependancies

## General

# Force systemd to rescan unit files after you've made changes
# No equiv
systemctl daemon-reload

# Change to runlevel 3
# equiv: telinit 3
systemctl isolate

# Make runlevel 3 the default runlevel
ln -sf /lib/systemd/system/ /etc/systemd/system/

# Specifying runlevel from Grub
# Edit the kernel command line in grub like you would to add init=/bin/bash
# but add #or


systemctl, systemd, init scripts, unit files, Linux, init, services, managing,

Latest Posts

Urldecode string (LUA)
FFMPEG Convert YUV444p to YUV420p (BASH)
Forcing FFMPEG to honour segment length in HLS Stream Creator (BASH)
Force CURL to place request to a specific IP (BASH)
Set a variable only if it is undefined (Javascript)
Ignore query string with Nginx caching proxy (NGinx)
Get breakdown of UK and non-UK votes for a Parliamentary Petition (Python)
Decompress Mozilla Firefox jsonlz4 bookmark backup files (Python)
Setting Git author details for a single repo (Git)
Checking Virtual Machine Resource Allocations with Libvirt (BASH)

Copyright © 2019 Ben Tasker | Sitemap | Privacy Policy
Available at and snippets.6zdgh5a5e6zpchdz.onion