I added some service to the startup script and then after reboot , i got this message-

24 package(s) needed for security, out of 52 available
Run "sudo yum update" to apply all updates.
-bash: id: command not found
-bash: id: command not found
-bash: id: command not found
-bash: tty: command not found
-bash: mktemp: command not found
-bash: $TMP: ambiguous redirect
-bash: rm: command not found

and then when i try to run most of the basic commands like netstat, ps, grep, ll etc , i get a error message like this

-bash: ls: command not found

but some commands like cp , chkconfig are working. I have checked that my /bin/bash file is present. what can be the reason ?

but before that i made following changes

echo "JAVA_HOME=/usr/java/jdk1.6.0_45" >> /etc/profile.d/custpath.sh
echo "export JAVA_HOME" >> /etc/profile.d/custpath.sh
echo 'PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile.d/custpath.sh
echo "export PATH" >> /etc/profile.d/custpath.sh

and changed /etc/environment file to

export JAVA_HOME=/usr/java/jdk1.6.0_45
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$CLASSPATH:/usr/java/jdk1.6.0_45/jre/lib
  • Sounds to me like you have clobbered your path. What happens if you prefix the commands which don't work with their full path, and what does 'echo $PATH' show ?
    – davidgo
    Jul 20 '15 at 5:42
  • Either your $PATH is messed up, or somebody just hacked into your system and tried to cover their tracks -- I've been in that situation. Can you post the output of /bin/echo $PATH? What happens if you run /bin/ls?
    – Larssend
    Jul 20 '15 at 5:43

Your Answer

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

Browse other questions tagged or ask your own question.