39 lines
802 B
Markdown
39 lines
802 B
Markdown
# systemctl
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
To list systemd services we will use systemctl command as below
|
|
# systemctl list-unit-files
|
|
|
|
To list active systemd services run
|
|
# systemctl | more
|
|
|
|
# systemctl list-units --type service
|
|
|
|
You can pipe the output to grep to search a more specific service as shown below
|
|
# systemctl | grep "apache2"
|
|
|
|
To check the services alongside the ports they are listening.
|
|
# netstat -pnltu
|
|
|
|
For example, to check if OpenSSH is running on your system, run
|
|
# systemctl status sshd
|
|
|
|
Alternatively, you can use the syntax below to check if the service is active
|
|
# systemctl is-active sshd
|
|
|
|
o check if OpenSSH is enabled, run
|
|
# systemctl is-enabled sshd
|
|
|
|
Ancien system:
|
|
check the status of OpenSSH, run
|
|
# service sshd status
|
|
|
|
You can also check all services by running
|
|
# chkconfig --list
|
|
```
|
|
|