Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 10-28-2009, 06:18 PM   #1
Registered: Sep 2009
Posts: 31

Rep: Reputation: 15
Export PATH

I was just reading about the command "Export PATH" and wasn't quite sure why this had to be done? This has confused me in the past.

Old 10-28-2009, 06:42 PM   #2
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 271Reputation: 271Reputation: 271
Basically you only have to export your path if you change it. Otherwise, changes won't take effect until after a logout/login.
Old 10-28-2009, 06:44 PM   #3
Registered: Mar 2008
Location: Baltimore Md
Distribution: ubuntu
Posts: 184

Rep: Reputation: 41
After you set a path it will be used by the current shell. If you don't export that path, any programs you run from the current shell will inherit the PATH that existed when the current shell was started. This applies to other variables as well. When you export PATH or export VARIABLE in general, that variable is available in the environment of the programs you run from the current shell. I agree it can be confusing at first, but after you work with the concept a little while it will seem natural and logical.
Old 10-28-2009, 09:14 PM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Not quite; any setting in the current shell (ie not exported) will be picked up by programs in the current shell level, but not by any sub-shells. What export does is 'export' (sic) those variables to all sub-shells/envs created from that shell ie unless you call a shell by




non-exported vars will not be avail to the new shell.


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
Ubuntu 8.04 loses my $PATH. Why do I have to repeatedly export PATH= ? oouc Ubuntu 10 09-14-2009 12:54 AM
export Path=/usr/java:$Path does not seem to work lumix Linux - Newbie 1 03-19-2007 04:11 PM
problems with export (path) mac1234mac Linux - Software 2 03-17-2006 04:04 AM
export path command davidleroux1 Mandriva 8 01-19-2006 09:22 PM
export PATH disappears twallstr Linux - General 4 12-13-2004 03:57 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:47 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration