6

I typed something in Bashrc and I can not use commands like cp, gedit, ls, etc. etc anymore. The terminal give me a message like:

Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found

I tried to restore bashrc, but I need to use cp and I can not use this command either:

Command 'cp' is available in '/bin/cp'
The command could not be located because '/bin' is not included in the PATH environment variable.
cp: command not found

What could I do? Thank you.

4
  • 2
    what if you use the full path for cp executable /bin/cp? – bistoco Oct 22 '15 at 1:25
  • Please don't use an ALL-CAPS title. – 40XUserNotFound Oct 22 '15 at 1:57
  • 1
    "What could I do?" "because '/bin' is not included in the PATH environment variable" add /bin to your PATH and use @bistoco hint. You need to fix the bashrc you edited ;-) – Rinzwind Oct 22 '15 at 2:20
  • I've solve this issue by following way : Check here... askubuntu.com/a/1318368/1185282 – Ketan Ramani Feb 22 at 12:30
30

It looks like your PATH variable got messed up.

If this ever happens to you, and you are running a /bin/sh (or variant such as /bin/bash)....enter the following on the command line:

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

Then you will be able to easily use the base UNIX commands without having to prefix them with /....blah..../command while you are fixing the problem.

2
  • 1
    I've run this command and without rebooting the path variables got lost again without editing the bashrc again. Am I doomed into having to constantly update path in .bashrc whenever installing new software? – janat08 Jan 20 '19 at 0:59
  • @janat08 it might be something in your bashrc that is causing the issue. I removed a export PATH line I had and it fixed the issue (I had added that line earlier). – Riza Khan Oct 27 '20 at 23:43

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