Ubuntu – How to reset $PATH to its default value in Ubuntu

command lineenvironment-variables

I accidentally unset all the directories of $PATH while trying to add a new one in ~/.bashrc. I opened a new terminal window as I was editing and now $PATH is empty. I'm worried if I boot from another drive to find the $PATH I won't be able to boot into this drive again.

Basically, what is the default result of echo $PATH?

Best Answer

The answer to your question is:

PATH=$(getconf PATH)

and works on any POSIX compliant system. The selected answer is the correct way to augment the path without obliterating prior existing content. If you use bash, you might consider:

PATH+=:$mynewdir