Results 1 to 5 of 5

Thread: PATH problem

  1. #1

    Default PATH problem

    I am using openSUSE10.3 gnome running as root. If open a gnome terminal and run:

    PATH=$PATH:/newdirectory

    echo $PATH

    I get: /old path stuff:/newdirectory

    so far OK.

    If I open another terminal and run echo $PATH, I get /old path stuff, /newdirectory is gone.

    How do I make a PERMANENT change to PATH?

    Thanks, Skippy

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,299
    Blog Entries
    15

    Default Re: PATH problem

    Quote Originally Posted by skippy1729
    I am using openSUSE10.3 gnome running as root. If open a gnome terminal
    and run:

    PATH=$PATH:/newdirectory

    echo $PATH

    I get: /old path stuff:/newdirectory

    so far OK.

    If I open another terminal and run echo $PATH, I get /old path stuff,
    /newdirectory is gone.

    How do I make a PERMANENT change to PATH?

    Thanks, Skippy
    Hi
    You need to modify either the .profile or .bashrc file with your
    commands. I prefer .profile

    --
    Cheers Malcolm (Linux Counter #276890)
    openSUSE 11.0 x86 Kernel 2.6.25.18-0.2-default
    up 16:40, 1 user, load average: 0.33, 0.62, 0.32
    GPU GeForce 6600 TE/6200 TE - Driver Version: 177.80


  3. #3
    Join Date
    Jun 2008
    Location
    Oregon, US
    Posts
    109

    Default Re: PATH problem

    To make it permanent, you need to edit your shell config file. For bash (the default), you need to add the following line to the file .bashrc in your home directory
    Code:
    export PATH=$PATH:/newdirectory
    Note the dot at the beginning of the file name, this makes it hidden by default.

    Changing the file /etc/profile will make the change for all users.

  4. #4

    Default Re: PATH problem

    Quote Originally Posted by elserj View Post
    To make it permanent, you need to edit your shell config file. For bash (the default), you need to add the following line to the file .bashrc in your home directory
    Code:
    export PATH=$PATH:/newdirectory
    Note the dot at the beginning of the file name, this makes it hidden by default.

    Changing the file /etc/profile will make the change for all users.
    Thank you, skippy

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,721

    Default Re: PATH problem

    To make the whole a bit more understandable by you I may add the following:

    PATH is an environment variable. It 'lives' in the environment of a process. As such it is inhereted by a child process from that particular process, not by any other processes.

    So when you start a terminal from your Gnome session (same for KDE of course) it gets the PATH from the Gnome process that starts the terminal. When you then change that PATH and start another process from that same terminal, it will inherrit the new PATH. Starting another terminal from Gome inherrits the old PATH from Gnome.

    Now when the above makes sense to you, it is in fact not true because the starting of a terminal runs a initialising script that wiill set some of the environment (including PATH) and so will overwrite what Gnome has (when it has them at all). What the answers above give you is a way to change that initialisation script, so every terminal you start thereafter will have the new PATH.
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •