Can't execute a simple LS command in my terminal?

jbosch

Registered
Hi,

I have a Mac OS Lion 10.7.3, for some estrange reason, when I go to my terminal, and execute a ls command I get a "command not found error".

I reader somewhere else in this forum about restoring a bash file or the Path. But I can't reach such file (maybe because I'm new to MAC). The fact is that if I can't execute commands, my mac is unuseless to me.

Anyone has any idea about how to fix this? Thanks.
 

ElDiabloConCaca

U.S.D.A. Prime
Try this:

1) Open Terminal.
2) At the prompt, type "echo $PATH" (without the quotes, of course) and press enter.
3) Post the results of that command here.

More than likely, you've installed some program that modified the PATH variable or modified some config file (.bashrc, .bash_profile, etc.) and accidentally put "export PATH=something" without doing "export PATH=$PATH:something" instead, completely wiping out the pre-defined PATH locations.

Here's a quick tutorial on changing the PATH variable:

http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/

In the meantime, you can still execute an "ls" command -- you just have to tell the Terminal where the ls program resides (hint: it should be in /bin)... instead of doing:
Code:
ls
...do this:
Code:
/bin/ls
...in the Terminal until you fix your PATH variable.
 
Top