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

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

Whatever I try to run, I get the error:

The command could not be located because '/usr/bin' is not included in the PATH environment variable.

I had some modification in my .bashrc file but then removed the two additional lines afterwards. However somehow the PATH variable seems to have been destroyed.

share|improve this question
up vote 8 down vote accepted

The PATH should restore on Reboot; anyways, if not the case you can find an Original .bashrc on: /etc/skel/.bashrc Overwrite using it; good luck.

share|improve this answer
6  
Here's the base path from a standard user on my system (which has sudo): /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. If you put into .bashrc: export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, then do source ~/.bashrc, it may restore the functionality you need. All this is in the terminal, of course. NOTE: I have not tested this! – Thomas W. Jul 11 '11 at 4:09
    
Life saver. thank you good sir. – dopatraman Nov 14 '14 at 3:18
    
@ThomasW. If you post your comment as an answer, I'll vote on it. Its a life saver. I used this to temporarily fix my PATH and edited ~/.bashrc to fix the offending line. – unekwu Apr 19 at 18:50
    
@unekwu Just upvote this, or possibly the answer from prime. I don't need the rep ;) – Thomas W. Apr 19 at 18:53

May be you accidentally did the following.

export PATH=<some path>

Actually you have replaced the PATH , may be what you should have done is ,

export PATH=$PATH:<some path>

but this may not be your case. But that same error can be used to recover ,

try below,

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

this should work.

share|improve this answer

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.