Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

My question is related to another open question. My echo $PATH gives me an output which is like


But running


gives me an output like

Command 'ifconfig' is available in '/sbin/ifconfig'
The command could not be located because '/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
ifconfig: command not found

after running command like given in other question

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

it runs ifconfig but blocks other commands of ruby rails or rvm.

Seeking help how to resolve this. Also why this happens?

share|improve this question
plz add the output of following command to the question: cat /etc/environment –  binW Apr 10 '12 at 12:06
BTW what Ubuntu version are you using? –  binW Apr 10 '12 at 12:13
Why this happens, is because your export command is overwriting your existing path. If you want to keep your existing path and append to it, you need a missing piece of magic: export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/gam‌​es" compare that to what is in your question and you will see what's wrong. –  gabe. Apr 24 '14 at 14:34

5 Answers 5

up vote -3 down vote accepted

If you are lost in path environment and want a quick solution for this, you can just create a link for ifconfig to a directory which is already in your path;

sudo ln -s /sbin/ifconfig /usr/bin/ifconfig
share|improve this answer
it worked and works even after i restart my terminal. thanks :) –  Sahil Grover Apr 11 '12 at 14:33
Are you planning on doing this with every single command in /usr/sbin that you might need? This answer might solve your immediate problem @SahilGrover but it's not a clean solution. I'd suggest taking the time to study some of the other answers and trying to determine why they aren't working for you. –  gabe. Apr 24 '14 at 14:22

You could easily solve this by adding /sbin to $PATH. The more important point is that, you should not have /sbin in the path by default.

See this page for a description of why: /sbin directory definition

/sbin contains system utilities that should be run by root or using sudo authority. So if you want to see your network configuration simply type:

sudo /sbin/ifconfig

You will be prompted for your password and then ifconfig will run.

share|improve this answer

/sbin is normally part of path. Other distros like fedora dont have it in PATH for normal users but I think Ubuntu always does. I will suggest you check your /etc/environment file and see if it is valid and has /sbin added to path. When I run cat /etc/environment, I get following output:

adnan@adnan-laptop:~$ cat /etc/environment 

As you can see /sbin is already part of PATH environment variable. If your file has the same contents then check its permissions otherwise add /sbin to PATH in this file. For me the permissions are:

adnan@adnan-laptop:~$ ls -l /etc/environment 
-rw-r--r-- 1 root root 79 2009-10-29 01:55 /etc/environment
share|improve this answer
its same over here all things –  Sahil Grover Apr 11 '12 at 14:31
Like Sahil, /etc/environment exists, has the correct permissions, and has the correct PATH inside it - but for some reason, all of a sudden, bash no longer uses it after a reboot today. –  Izkata Mar 30 '14 at 14:37

Your original $PATH (the line you posted is not very readible):


You have /usr/local/bin, /usr/bin and /bin. As you already found out ifconfig is inside /sbin.

So where that path is set you also need to include /sbin.

See rubygems docs on how to do this.

share|improve this answer
and how do i do that ?? –  Sahil Grover Apr 10 '12 at 10:32

Try the command below

export PATH=$PATH:/usr/sbin

OR (if you want to set all the paths)

export PATH=$PATH:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games
share|improve this answer
please read carefully again my question what i have written. –  Sahil Grover Apr 10 '12 at 10:44
add this line to your ~/.bashrc: export PATH=$PATH:/usr/sbin –  konrad Apr 10 '12 at 11:02
@konard sorry, it is not working. –  Sahil Grover Apr 10 '12 at 11:10
After editing your rc files, I usually type source ~/.rcFileName to reload the changes. –  theTuxRacer Jan 21 '13 at 8:09

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.