Systemd is an init system used by new Linux distributions like Ubuntu 15 and Centos 7. It intends to replace Sysv init (Ubuntu, Centos, etc) and upstart (Ubuntu).
Here are some handy Systemd/systemctl commands:
- List units
$ sudo systemctl list-units ## all loaded units in active state $ sudo systemctl list-units -all ## all loaded units in any state $ sudo systemctl list-unit-files ## all installed units
- Check status of a service
$ sudo systemctl status httpd httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) Active: active (running) since Sun 2016-08-21 14:39:03 CEST; 9min ago Docs: man:httpd(8) man:apachectl(8) Main PID: 3095 (httpd) Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec" CGroup: /system.slice/httpd.service ├─3095 /usr/sbin/httpd -DFOREGROUND ├─3096 /usr/sbin/httpd -DFOREGROUND ├─3097 /usr/sbin/httpd -DFOREGROUND ├─3098 /usr/sbin/httpd -DFOREGROUND ├─3099 /usr/sbin/httpd -DFOREGROUND └─3100 /usr/sbin/httpd -DFOREGROUND
This outcome tells that httpd is currently running and it is active and hence will also start at boot time.
To just see if service is active
$ sudo systemctl is-active httpd active
To just see if service is enabled (will start at boot time)
$ sudo systemctl is-enabled httpd enabled
- Start a service
$ sudo systemctl start httpd ## or $ sudo systemctl start httpd.service
- Re-start a service
$ sudo systemctl restart httpd ## or $ sudo systemctl restart httpd.service
- Stop a service
$ sudo systemctl stop httpd ## or $ sudo systemctl stop httpd.service
- Enable a service during boot
$ sudo systemctl enable httpd ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
- Disable a service during boot
$ sudo systemctl disable httpd rm '/etc/systemd/system/multi-user.target.wants/httpd.service'