My Most useful systemd commands
systemctl list-unit-files | grep enabled
systemctl status
systemctl list-unit-files --state=enabled,disabled,failed
systemctl --type=service
- list all networks :
networkctl status --all
networkctl list
man systemd.network.5
- list all enabled services :
systemctl list-unit-files | grep enabled
systemctl list-unit-files --state=enabled
- see all of the running services :
systemctl list-units --type service --state running
command systemctl --no-page --no-legend --plain -t service --state=running
- see the overview of all active and failed services :
systemctl list-units --type service --state running,failed
systemctl --failed
- analyze systemd boot process :
systemd-analyze
systemd-analyze blame
systemd-analyze critical-chain
- analyze security features :
systemd-analyze security tor.service
- check if a unit is enabled or not :
systemctl is-enabled crond.service
- check if a unit is running or not :
systemctl status firewalld.service
- list all services (enabled,disabled) :
systemctl list-unit-files --type=service
- start, restart, stop, reload a service :
systemctl start httpd.service
systemctl restart httpd.service
systemctl stop httpd.service
systemctl reload httpd.service
- mask (making it impossible to start) or unmask a service :
systemctl mask httpd.service
ln -s '/dev/null' '/etc/systemd/system/httpd.service'
systemctl unmask httpd.service
rm '/etc/systemd/system/httpd.service'
- Kill a service using :
systemctl kill httpd
systemctl status httpd
- list all system mount points :
systemctl list-unit-files --type=mount
- list all available system sockets :
systemctl list-unit-files --type=socket
- get the current cpu Shares of a Service :
systemctl show -p CPUShares httpd.service
- limit Share of a service to 2000 CPUShares :
systemctl set-property httpd.service CPUShares=2000
systemctl show -p CPUShares httpd.service
- check all configuration details of a service :
systemctl show httpd
- analyze critical chain for a services :
systemd-analyze critical-chain httpd.service
- get a list of dependencies for a services :
systemctl list-dependencies httpd.service
- list control groups hierarchically :
systemd-cgls
- list control group according to CPU, memory, Input and Output :
systemd-cgtop
- start system rescue mode :
systemctl rescue
- enter into emergency mode :
systemctl emergency
- get current run levels in used :
systemctl get-default
- start Runlevel 5 or graphical mode :
systemctl isolate runlevel5.target or
systemctl isolate graphical.target
- start Runlevel 3 or multiuser mode (commandline) :
systemctl isolate runlevel3.target or
systemctl isolate multiuser.target
- set multiusermode or graphical mode as default runlevel :
systemctl set-default runlevel3.target
systemctl set-default runlevel5.target
man runlevel
- see hard disk space occupied by the logs :
sudo journalctl --disk-usage