You are not logged in.

#1 2007-05-09 03:02:44

jmags
Member
Registered: 2006-03-07
Posts: 48

Is there a single file that holds all of my PATH data?

In the process of getting some things (Skype and Maven) to run I've managed to get some directories to appear twice when I echo $PATH. Is there a single file that I can edit to as to keep this list tidy and readily accessible?

Offline

#2 2007-05-09 03:20:25

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Is there a single file that holds all of my PATH data?

Try looking in /etc/profile and /etc/profile.d

The basic pathing is called from /etc/profile and within that script it calls any path scripts located in /etc/profile.d/

Last edited by shen (2007-05-09 03:26:30)

Offline

#3 2007-05-09 03:37:05

F
Member
Registered: 2006-10-09
Posts: 322

Re: Is there a single file that holds all of my PATH data?

or try your .${shell}rc file.

ie. ~/.bashrc or ~/.zshrc.


perhaps  your ~/.bash_profile will have it, aswell.

Offline

#4 2007-05-09 04:37:43

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: Is there a single file that holds all of my PATH data?

I think the tidiest approach is to set PATH's on a per-user basis in ~/.bashrc. Using .bashrc means that $PATH is set for both login and interactive shells since the default .bash_profile reads in .bashrc. Something like export PATH="$PATH:/new/path". For new system-wide path's set them in /etc/profile by appending to the line that's already in there.

Offline

#5 2007-05-09 11:11:55

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Is there a single file that holds all of my PATH data?

I agree if you want to add any custom PATH then do it in .bashrc in your home directory. If you want to see any current system PATH variables look in the areas I posted above.

Offline

#6 2007-05-10 01:25:32

jmags
Member
Registered: 2006-03-07
Posts: 48

Re: Is there a single file that holds all of my PATH data?

Thanks for the answers. Nevertheless, there are more things about which I am curious. For example, if I enter "export PATH = $PATH:/some/new/path" on the command line, is that written into my .bashrc?

Offline

#7 2007-05-10 01:45:51

Pudge
Arch Linux f@h Team Member
Registered: 2006-01-23
Posts: 300

Re: Is there a single file that holds all of my PATH data?

jmags wrote:

Thanks for the answers. Nevertheless, there are more things about which I am curious. For example, if I enter "export PATH = $PATH:/some/new/path" on the command line, is that written into my .bashrc?

Your path is in a system variable named PATH.  By convention, variable names are in all capital letters.  To access this variable in bash, you put a $ in front of the variable name, in this case $PATH.  The command

export PATH = $PATH:/some/new/path"

entered on the command line appends /some/new/path to the system variable named PATH.  It does not change .bashrc in any way.  In fact, if you want your new PATH set everytime you enter bash, put the
export PATH=$PATH:/some/new/path
in your .bashrc file, and it will be executed every time you start bash and be there automatically for you.

For further info on this, look at the man page for bash

$ man bash

Shell Variables
       The following variables are set by the shell:

    HOME   The home directory of the current user; the default argument for
               the cd builtin command.  The value of this variable is also used
               when performing tilde expansion.

    PATH   The  search  path for commands.  It is a colon-separated list of
              directories in which the shell looks for commands  (see  COMMAND
              EXECUTION  below).   A  zero-length (null) directory name in the
              value of PATH indicates the current directory.  A null directory
              name  may  appear  as  two  adjacent colons, or as an initial or
              trailing colon.  The default path is  system-dependent,  and  is
              set  by  the administrator who installs bash.  A common value is
              ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.

as a couple of examples.   

Pudge

Last edited by Pudge (2007-05-10 01:55:16)

Offline

#8 2007-05-10 03:04:30

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: Is there a single file that holds all of my PATH data?

jmags wrote:

Thanks for the answers. Nevertheless, there are more things about which I am curious. For example, if I enter "export PATH = $PATH:/some/new/path" on the command line, is that written into my .bashrc?

No, that will only set your $PATH variable for that window. As soon as you close the window (assuming it's a terminal running in X) the change will be gone.

Offline

Board footer

Powered by FluxBB