Linux services and daemons can be controlled with
chkconfig command is mainly used to set given service or daemon run level. In order to work with
chkconfig command we need root privileges.
systemctl command suite provides more and detailed features. Related tutorial can be accessed from following link.
List All Existing Service and Daemons
We can use
chkconfig command in order to list all installed services and daemons like below. We will use
--list as option.
$ chkconfig --list
List Specific Service and Daemon
We can also list only specific service without listing all of them. There is two way for this first way is providing the service name with the
--list option. In this example we will list service named
$ chkconfig --list sshd
Second way is listing all services and daemons but filtering them with
grep command. We will provide the service name to the
grep command like below.
$ chkconfig --list | grep sshd
We can use
chkconfig command also enable services. Enabling services will make them to start automatically if specified run level activated. In this example we will enable
sshd service for run levels 2, 3, 4, 5 . We need root privileged for this command. We will use
onkeyword after the service name.
$ sudo chkconfig --level 2345 ssh on
We can also disable services and daemons for given run level. We will provide the
offkeyword after the service name which is very similar to service enable. In this example we will disable the
sshd service for service level 2 .
$ sudo chkconfig --level 2 ssh off