#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    262
    Rep Power
    14

    Adding a Directory to the PATH


    I'm using Red Hat Linux 6.2, can anybody tell me how I can add a directory to the Path pls. My fingers are falling off typing full directory locations to commands!

    thanks
  2. #2
  3. 11
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jul 2001
    Location
    Lynn, MA
    Posts
    4,635
    Rep Power
    82
    Coupla' things-

    You can use "tab autocompletion" to complete a filename/path. Partially type something and then hit tab once (or twice on some distros, I think you can edit this) to see a list of possible completions.

    If you're using bash, edit your ".bash_profile" file in your home directory and add
    Code:
    export PATH =$PATH:/new/path/to/add:/other/new/path
    If you're not sure if you're using bash, type
    Code:
    echo $SHELL
    and you'll see what shell you're using.

    I don't remember if you need to logout and log back in for it to take effect. type
    Code:
    printenv |less
    or just
    Code:
    echo $PATH
    to see your path.
    If you don't see your updated path you probably need to logout and back in.

    If you want to make it system wide, I think you edit the /etc/skel/.bash_profile, but I don't really remember.

    Sorry if I'm being too basic. Not sure where you're at with your *nix skills.

    Good luck!
    Last edited by Hero Zzyzzx; November 21st, 2001 at 07:55 AM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    262
    Rep Power
    14
    Thanks for the reply.

    I got it to work for a particular user. But I want it to work for specifically the root user, or everybody - either it doesn't matter.

    The server I'm using came pre-setup by the hosting company with two root users, one of which I do not use, it is for emergency access. The other is the one accessed when you su - , how this is done I've no idea!

    In the home dir of this root user there is a .tcshrc which contains a set path statment. I added the path into this, logged out etc, however it wasn't available after when I "echo $PATH"ed .

    I also tried the etc/skel/ method and this ddidnt work either...

    Any other ideas?
  6. #4
  7. 11
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jul 2001
    Location
    Lynn, MA
    Posts
    4,635
    Rep Power
    82
    then edit the .bash_profile (again, this is assuming you're using the bash shell. If you aren't, then it's different) of the root user.
    here's how the commands might look
    Code:
    su
    cd ~
    pico .bash_profile
    ## Enter the stuff from above into the file
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    262
    Rep Power
    14
    Ok,

    normal users are using bash. But the root user is using tcshrc (whatever this is I have no idea!).

    Any hints on what to do here?

IMN logo majestic logo threadwatch logo seochat tools logo