.dotfiles/navi/systemctl.cheat

38 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2020-09-12 21:47:55 +00:00
% systemctl
# Start service
sudo systemctl start <service_inactive>
# Stop service
sudo systemctl stop <service_active>
# Enable service
sudo systemctl enable <service_disabled>
# Disable service
sudo systemctl disable <service_enabled>
# Restart service
sudo systemctl restart <service>
# Reload service
sudo systemctl reload <service_active>
# Service status
sudo systemctl status <service>
# List running services
sudo systemctl list-units --type=service --state=running
# List enabled services
sudo systemctl list-unit-files --type=service --state=enabled
# List disabled services
sudo systemctl list-unit-files --type=service --state=disabled
$ service_inactive: systemctl list-units --type=service --state=inactive | awk '{print $1}' | grep .service | sed 's/.service$//'
$ service_active: systemctl list-units --type=service --state=active | awk '{print $1}' | grep .service | sed 's/.service$//'
$ service_enabled: systemctl list-unit-files --type=service --state=enabled | awk '{print $1}' | grep .service | sed 's/.service$//'
$ service_disabled: systemctl list-unit-files --type=service --state=disabled | awk '{print $1}' | grep .service | sed 's/.service$//'
$ service: systemctl list-units --type=service --all | awk '{print $1}' | grep .service | sed 's/.service$//'