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.

Every time I run a new terminal window (before I do a single thing), I am greeted with these messages:

env: bash: No such file or directory
env: bash: No such file or directory
env: bash: No such file or directory
env: bash: No such file or directory
env: bash: No such file or directory
-bash: grep: command not found
-bash: tar: command not found
-bash: cat: command not found

For instance, when I type cd ~/, I get: -bash: find: command not found.

Can anyone help? I don't know where to start. Thanks in advance!

share|improve this question

migrated from stackoverflow.com Apr 9 '12 at 6:31

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 2 down vote accepted

Looks like your $PATH environment variable is screwed or has been reset. You'll have to find out where it is being set (or appended to). When you login, the system runs /etc/profile and then ~/.bash_profile (depending on your shell). Make sure $PATH is set correctly then make sure that grep/tar/cat are actually in your path.

share|improve this answer
    
i had a $PATH line in my .bash_profile which i deleted and now everything worked as before. i'll do more research, but should i reset $PATH somewhere now? –  pruett Apr 8 '12 at 3:39
    
Usually, when you set PATH, you do it incrementally. That is, the new value is set with something like: export PATH=$NEWBINDIR:$PATH or export PATH=$PATH:$NEWBINDIR. You can get more complicated; I use a script which weeds out duplicate entries from a PATH so it stays short. But you should keep /bin and /usr/bin on the PATH at a minimum, unless you have an extremely good reason to change that setting (such as /bin is a symlink to /usr/bin, as on Solaris; then you only need one of the two entries). –  Jonathan Leffler Apr 8 '12 at 5:40

It looks like there is something wrong with your profile (~/.profile). Check the content of ~/.bashrc and also /etc/profile

It seems there's something wrong in these files; it looks like PATH is either missing or malformed.

PATH should contain both /usr/bin and /bin, usually set in /etc/profile.

share|improve this answer
    
We can debate the relative wisdom of the colon at the start of PATH; that means that commands in the current directory are executed in preference to those in the system directories. The colon at the end means that the current directory is also at the end of the PATH. –  Jonathan Leffler Apr 8 '12 at 2:59
    
sorry, maybe I was not clear enough with the colons I've meant those 2 directories should be there. the PATH should not start and end with colons, however there should be a colons in place to separate directories. It's not that easy to diagnose this without seeing the contents of the profile, however it looks like that there is something set up in the profile for PS1 which cannot run as it's not in PATH –  Istvan Apr 8 '12 at 3:06
    
It's odd that the commands listed are things like tar and find. It's not so uncommon to use grep or cat or env. I agree with your assessment; so does the accepted answer. –  Jonathan Leffler Apr 8 '12 at 5:44

Your Answer

 
discard

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