How to reset $PATH on CentOS 6.5

8,943

You can execute the following command to add /bin, or whichever directory you need, to PATH.

export PATH="$PATH:/bin"

You can then add that line to .profile or .bashrc (if you use bash) to make sure that directory is included in your path each time you log in.

Share:
8,943
Jorg Ancrath
Author by

Jorg Ancrath

Updated on September 18, 2022

Comments

  • Jorg Ancrath
    Jorg Ancrath almost 2 years

    I had a server restart and since then I am no longer able to run any commands under SSH.

    Any command will just return something like: -bash: ls: command not found

    I realize my $PATH must have been changed somehow, doing /bin/ls seems to work fine.

    An echo $PATH returns:

    /usr/local/sbin:/usr/sbin:/sbin:$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin:/root/bin
    

    I would assume Java is the culprit here, but how do I go around resetting my $PATH variable?