Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Why do I need to type the full path to the command?

# /sbin/ifconfig

I have a server where I can simply type ifconfig and on some other servers I have to type /sbin/ as well. This is really annoying. How do I have consistent behavior?

share|improve this question
    
As commented on in your question about su and bash, you should accept answers to some of your questions. Just click the check mark next to the answer you think is best. –  Ward Feb 17 '11 at 6:25

1 Answer 1

up vote 3 down vote accepted

Modify your .bashrc to include /sbin in your search path.

PATH=/sbin:$PATH
export $PATH

This will add /sbin (and if you want to add it, /usr/sbin as well) to your command search path.

share|improve this answer
    
PATH=$PATH:$HOME/bin # this line is already there. Do I edit the same line or add one more line as suggested by you? How do I get both /sbin and /usr/sbin? –  shantanuo Feb 17 '11 at 7:11
    
Edit the line like PATH=/sbin:$PATH:$HOME/bin/ and don't forgot to #source .bashrc so that the new settings are available to current shell –  nitins Feb 17 '11 at 7:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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