-1

I am getting the following error when running ls or nano or clear in the terminal...

SE-ASLAE002-MB1:~ aslae002$ ls
-bash: ls: command not found
SE-ASLAE002-MB1:~ aslae002$ nano newfile
-bash: nano: command not found
SE-ASLAE002-MB1:~ aslae002$ cd ~
SE-ASLAE002-MB1:~ aslae002$ clear
-bash: clear: command not found

This is what typing echo $PATH in the command line looks like...

SE-ASLAE002-MB1:~ aslae002$ echo $PATH
/usr/local/bin:/usr/local/sbin:

For what ever reason, commands like cd or exit work. It was working fine the last time I used the terminal yesterday, but when I shut the computer down and restarted nothing is working. Any ideas?


Update...

Changed path to export PATH=/bin:$PATH and ls now works, but sudo clear source and many other commands aren't working...

1

cd & exit are shell builtins. ls is typically installed in /bin. /bin is missing from your path.

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

should fix it.

  • Thank you thank you thank you! That worked. I really appreciate it. – Erik Åsland Apr 5 '16 at 17:43
  • Actually, that only fixed ls. sudo and clear and many others still don't work. – Erik Åsland Apr 5 '16 at 18:37
  • I had to change my .bash_profile to from export PATH=/bin:/usr/bin:/usr/local/bin:$PATHx to export PATH=/bin:/usr/bin:/usr/local/bin:. Since I didn't give anyone the information to figure that out, if you edit your answer to reflect these changes, I will give you credit for the answer. – Erik Åsland Apr 5 '16 at 18:45
  • Added /usr/bin to the command. Also worth noting, if you're adding this to your .bash_profile you don't need the export. – skarface Apr 5 '16 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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