Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-22-2003, 01:42 PM   #1
Registered: Aug 2003
Location: CA USA
Distribution: FC2, FC4, Mandrake 10, Slackware 10, RedHat 9, Suse 9.1, College Linux, Debian Sarge, Gentoo
Posts: 170

Rep: Reputation: 30
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?
Old 08-22-2003, 01:49 PM   #2
LQ Newbie
Registered: Jul 2003
Location: Los Angeles
Distribution: CentOS
Posts: 14

Rep: Reputation: 0
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
Old 08-22-2003, 01:55 PM   #3
Registered: Jun 2003
Location: Florence, SC
Distribution: Gentoo i386
Posts: 180

Rep: Reputation: 30
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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I remove a variable from PATH melinda_sayang Slackware 17 02-28-2009 12:55 PM
PATH variable jk21 Linux - Newbie 1 09-28-2004 02:48 PM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM
the path variable mjkramer Linux - Newbie 4 10-18-2003 07:18 AM
PATH variable file pongsu Linux - General 2 09-25-2003 04:13 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration