Service command not found error.

Some times while running service commands gives us error messages like: service command not found no need to panic dude answer is as simple the error all you have to do is to include /sbin in you your PATH environment variable we can include /sbin in PATH in many ways the simplest one is:

run this command in you bash shell

$export PATH=/sbin:$PATH

This will solve the purpose. But this change is visible only in that shell to make this change permanent you have to copy paste the above line in file ~/bash_profile if you are a centOS user but if you are using Ubuntu then paste the above line in  ~/.bashrc . You can open ~/.bashrc file by the following comman:

$sudo gedit ~/.bashrc

and to see /sbin is included in your PATH variable run the following command:

$echo $PATH



this command will display all the environment variables along with PATH and if now you will run service command it will gives you following o/p:

vidur@vidur-Vostro1510:~$ service
Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s