🖥️systemctl

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the systemctl command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#    ███████╗██╗   ██╗███████╗████████╗███████╗███╗   ███╗ ██████╗████████╗██╗     
#    ██╔════╝╚██╗ ██╔╝██╔════╝╚══██╔══╝██╔════╝████╗ ████║██╔════╝╚══██╔══╝██║     
#    ███████╗ ╚████╔╝ ███████╗   ██║   █████╗  ██╔████╔██║██║        ██║   ██║     
#    ╚════██║  ╚██╔╝  ╚════██║   ██║   ██╔══╝  ██║╚██╔╝██║██║        ██║   ██║     
#    ███████║   ██║   ███████║   ██║   ███████╗██║ ╚═╝ ██║╚██████╗   ██║   ███████╗
#    ╚══════╝   ╚═╝   ╚══════╝   ╚═╝   ╚══════╝╚═╝     ╚═╝ ╚═════╝   ╚═╝   ╚══════╝
                                                                                              
                                                                                              
                                                                                              
# List all loaded/active units
systemctl list-units

# Check the status of a service
systemctl status foo.service

# Start a service
systemctl start foo.service

# Restart a service
systemctl restart foo.service

# Stop a service
systemctl stop foo.service

# Reload a service's configuration
systemctl reload foo.service

# Enable a service to startup on boot
systemctl enable foo.service

# Disable a service to startup on boot
systemctl disable foo.service

# List the dependencies of a service
# when no service name is specified, lists the dependencies of default.target
systemctl list-dependencies foo.service 

# List currently loaded targets
systemctl list-units --type=target

# Change current target
systemctl isolate foo.target

# Change default target
systemctl enable foo.target

#==============================#
# CMD SYSTEMCTL
#==============================##==============================#
# We can even use systemctl to get detailed information about an service

systemctl status sshd -l
#

systemctl --type=service
#

systemctl status ntpd.service
#

systemctl isolate multi-user.target
#

systemctl disable $unit.service
#

systemctl stop $unit.service
#

systemctl start $unit.service
#

systemctl list-unit-files | grep enabled
# Show services that are set to start up automatically on a systemd based system.

systemctl stop SERVICENAME
# systemd stop running service

systemctl start SERVICENAME
# start SERVICENAME

systemctl restart SERVICENAME
# systemd restart running service 

systemctl reload SERVICENAME
# reloads all config files for service

systemctl status SERVICENAME
# systemctl show if service is running

systemctl enable SERVICENAME
# systemctl - enable service at boot  

systemctl disable SERVICENAME
# systemctl - disable service at boot  

systemctl show SERVICENAME
# show systemctl service info

systemctl -H target command SERVICENAME
#  run systemctl commands remotely

systemctl list-dependencies
# show and units dependencies 

systemctl list-sockets
# systemd list sockets and activities 

systemctl list-jobs
# view active systemd jobs

systemctl list-unit-files
# systemctl list unit files and their states

systemctl list-units
# systemctl list default target (like run levlel)

systemctl reboot
#  systemctl reboot the system

systemctl poweroff
# systemctl shutdown (power off the system)

systemctl emergency
# Put in emergency mode

systemctl default
# systemctl default mode

systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
# Disable sleep mode via cli and systemd (Centos, Debian Ubuntu?) - This causes computer to never power off or go into sleep mode. Disables sleep mode linux.

# restart Bluetooth from terminal
systemctl restart bluetooth

# Get CPU thermal data on MacOS
sysctl machdep.xcpm.cpu_thermal_level

#==============================##==============================#
# CMD SYSTEMCTL						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░