Friday, May 3, 2024
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 191980  / 2 Years ago, fri, january 28, 2022, 5:59:17

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?


More From » command-line

 Answers
3

Adding :$PATH to the end of the export line fixed the problem e.g. export PATH=<directory to be added>:$PATH



I add this line to the ~/.bash_rc file instead of the ~/.profile file so I can see the effect immediately in a new terminal and for other reasons based on the information here: https://superuser.com/questions/176404/linux-bash-not-loading-profile-in-new-session



For me, the default output of echo $PATH before adding the new directory is:



/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games


[#39826] Sunday, January 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
damomnning

Total Points: 422
Total Questions: 90
Total Answers: 106

Location: Mali
Member since Thu, Aug 13, 2020
4 Years ago
;