Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

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)

share|improve this question

marked as duplicate by slhck May 15 '13 at 12:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 2 down vote accepted

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 user's $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.

share|improve this answer
    
Assuming they are using bash. –  vgoff May 15 '13 at 12:03
    
@vgoff the question is tagged with bash. –  terdon May 15 '13 at 12:05
    
Yes, it is. Didn't notice initially. Left it after I hit 'add comment' –  vgoff May 15 '13 at 12:06
    
Wouldnt that add the path to $PATH again and again? And which would be the correct path to store own written bash files then? files, that the user may execute? –  rubo77 May 15 '13 at 12:15
    
@rubo77 The PATH is only set for a shell session, and .bashrc is only called once at the start of the session. Your own scripts, you could store them in ~/bin, and add that to the path, for example. –  slhck May 15 '13 at 12:19

Add the following to the end of the .bashrc of the user:

export PATH=/usr/local/sbin:$PATH
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.