Friday, August 4, 2017

bash - Add /usr/local/sbin to the PATH of a user



if I type


echo $PATH

I only get



/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games



how can I add /usr/local/sbin to the path, so it is already there the next time?


(I use debian squeeze)


Answer



The easiest way is to add this line to your user's ~/.bashrc file:


export PATH=$PATH:/usr/local/sbin

Bear in mind that /sbin/, /usr/sbin and /usr/local/sbin are not in normal users' $PATHs by default because these directories tend to contain "dangerous" executables. Things like fdisk or deluser that need administrative privileges and can harm your computer. They should be in root's path by default and you need to be root to run them anyway, so it migh be a good idea not to add them to a normal user's $PATH.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...