The command could not be located because '/sbin' is not included in the PATH environment variable

You can do either of the following:

  • Open your ~/.bashrc file and write the following to the end:

    export PATH=$PATH:/sbin
    

and then do source ~/.bashrc or open a new terminal instance.

  • or open your /etc/environment and add /sbin to end of the PATH variable, so that is as follows:

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/games:/sbin"
    

Add /sbin to the system path by running,

export PATH=$PATH:/sbin

If you follow @nux's answer, you have to create symbolic links for all the command files which are presented inside /sbin directory.But if you follow this or @jobin's answer, you don't need to go for that.


You'll need to add /sbin to your path environment variable

  1. Create a new file in /etc/profile.d/custom-envs.sh (file must ends with .sh)

    set the following file content:

    export PATH=$PATH:/sbin
    
  2. Add execute permissions

    sudo chmod +x /etc/profile.d/custom-envs.sh
    

To apply changes, you'll need to logout and login again