Search code examples
linuxbashsshrhelrhel7

Every command returns error in Rhel


I am using SSH to connect a remote server. I did some installations and wanted to test whether they start after reboot. I rebooted the machine with sudo reboot. SSH session dropped. I reconnected. After login, every command I type, whether it is valid or not returns following output.

-bash: id: command not found
-bash: id: command not found
-bash: id: command not found
-bash: tty: command not found
-bash: uname: command not found
-bash: whoami: command not found
-bash: sed: command not found
-bash: logger: command not found

What to do to get rid of this situation?

Thanks.


Solution

  • Your path has been messed up and you will have to readd anything needed to your path.

    This can be done by issuing the following command

    export PATH="$PATH:[directory to append to path]"

    in the case of the commands not found this path might get you going on the right path

    export PATH="$PATH:/bin"

    This however does not keep the $PATH value across reboots in which case the system file holding the path settings will need to be edited.