15

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.

yayu
  • 3,391

2 Answers2

16

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.

  • 10
    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 Ward Jul 11 '11 at 04:09
  • 1
    @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. – Emmanuel John Apr 19 '16 at 18:50
  • 1
    @unekwu Just upvote this, or possibly the answer from prime. I don't need the rep ;) – Thomas Ward Apr 19 '16 at 18:53
12

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.

prime
  • 223
  • 2
  • 5