Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 3 down vote accepted

Modify your .bashrc to include /sbin in your search 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


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.