Every command fails with "command not found" after changing .bash_profile?

It looks to me that at one point or another you are overwriting the default PATH environment variable. The type of errors you have, indicates that PATH does not contain /bin, where the above commands (including bash) reside.

For example, if you do

PATH=/home/user/bin

instead of

PATH="$PATH":/home/user/bin

One way to begin debugging your bash script would be to start a subshell with the -x option:

$ bash --login -x

This will show you every command, and its arguments, which is executed when starting that shell.

The --login option is specified because .bash_profile is read by login shells. Further information on debugging bash scripts can be found here: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html.

Ultimately, I think that January's suggestion will work for you, but that link is worth a read for future problems.


I may have found the problem. It worked for me, and it might work for you...

I was defaulting with my editor to Windows (LF/CR) saves. Since I use both systems, it seemed logical. When I needed to mess with my .bash_profile, I realized after commenting out and tryig things that nothing worked. I changed my saves to OS X format (CR only) and voilà! No more "command not found" in the terminal!

It may just be that easy!