LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to remove PATH variable? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-remove-path-variable-84606/)

greg108 08-22-2003 01:42 PM

how to remove PATH variable?
 
If I want to add search path to PATH variable I type
export PATH=$PATH:~/bin (for example)

So how can I remove this path?

rjliebenberg 08-22-2003 01:49 PM

You could reset the PATH variable.
export PATH=/bin:/usr/bin

This would just be for that session. For all user sessions edit the ~/.bashrc of the user or /etc/profile for the machine

beaucoup 08-22-2003 01:55 PM

Typing
echo $PATH
Will show you what your full current path is. Then, you can retype the whole thing without the parts you don't want, like this;
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11

If you want to get fancy and automatic, you can use the sed program to remove the last entry automagically.

export PATH=`echo $PATH | sed 's/:[^:]*$//'`

Just copy and paste that to a terminal.

Remember, everything you export is forgotten when you log out anyway, unless you put the command in your ~/.bashrc file.

-Andrew


All times are GMT -5. The time now is 07:40 AM.