Software >> OS >> Unix >> Linux >> RHEL >> 7 >> commands >> systemctl >> Examples of systemctl command usage

 

Purpose command
List all services and their states systemctl list-unit-files --type service
Enable a specific service to auto start on boot e.g. httpd.service systemctl enable httpd.service
Check detailed status of a service e.g. httpd.service systemctl status httpd.service
List services that will automatically start on boot systemctl list-unit-files --type service | grep enabled
List all system units (all types not just services) that will automatically start on boot systemctl list-unit-files | grep enabled
Restart network service systemctl restart network.service
Show status of particular service systemctl status servicename
List units of type service

systemctl list-units --type=service

or just

systemctl --type=service

can also itemize by finding all *.service files in /etc/lib/systemd

Enable/Disable a service

systemctl enable servicename

systemctl disable servicename

e.g.

systemctl enable httpd.service