Error- bash: service: command not found – Install initscripts

On a minimal Linux system sometimes you can face the error while dealing with any system service to start|stop|restart|enable it. This error “bash: service: command not found” appears because the “initscripts” package has not been installed on your system.

bash service command not found Install initscripts

Here are the commands to install Service on different Linux operating systems-

Debian/Ubuntu

apt install sysvinit-utils

Kali Linux

apt install init-system-helpers

RHEL/CentOS/Rocky Linux/ AlmaLinux

yum install initscripts

Fedora

dnf install initscripts

Raspbian

apt-get install sysvinit-utils

 

Once the installation is completed, you can use the Service command to handle various Linux services-

Common service command syntax.

To Start/Stop/Restart/Reload service

service service-name start|stop|restart|reload

examplesudo service apache2 start

 

For full restart  

service system-service-name --full-restart

examplesudo service mysql --ful-restart

 

Show the current status of a service:

service system-service-name status

examplesudo service apache2 status

 

List the status of all services:

service --status-all

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

X