Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I open terminal I get an automatic error message -bash: PATH command not found. then I am stumped in getting multiple -bash "x" command not found. messages, even to simple commands such as ls cd mkdir rm.
Just about the ONLY commands I get a response to are echo and export. Could my Unix system files be corrupt, as has been suggested in some searches for help? My hunch is that there is some setting that directs me away from the proper spot to make UNIX commands, but I don't know how to fix that.

share|improve this question
2  
My guess is that you have some faulty syntax in one of the startup files when attempting to set your PATH (given the first error). If your PATH is set to something wonky because of this, it would explain the other errors. Could you post your ~/.bashrc file? –  Steven D Feb 8 '11 at 0:07
    
It may be worthwhile to try executing some of those commands using their full paths, just to be sure it's a path issue (which seems likely). Try /bin/ls and see what happens. –  gabe. Feb 8 '11 at 1:57
add comment

1 Answer 1

Your .bashrc or .bash_profile files (or other startup files) contain a typo, and your PATH is invalid. To really be certain, we'd need to see your .bashrc or .bash_profile files.

Commands like ls mkdir rm won't work because your shell cannot find them in your PATH, because your PATH is invalid. Commands like echo and "export are built in to Bash, which is why they work. I can't explain the problem with cd (perhaps a mistake?)

Search your .bashrc or .bash_profile files and look for the lines where PATH is defined. You might have a bad definition where second PATH doesn't start with a $, like this:

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

It should say something like this:

export PATH=$PATH:/usr/local/bin:/usr/local/sbin
export PATH=$PATH:/opt/local/bin:/opt/local/sbin
share|improve this answer
    
Um, cd is built into the shell. It should work even with an invalid PATH. –  Michael Ratanapintha Feb 8 '11 at 3:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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