Results 1 to 9 of 9

Thread: adding directory to PATH?

  1. #1
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,175

    Question adding directory to PATH?

    What's the syntax to add a directory to my path search for calling executables from the command line? (I think this would be a mod for .bashrc and .tcshrc)

    Thank You!
    PattiM

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

    Default Re: adding directory to PATH?

    Unless you specifically use csh or tcsh for something you should only have to change it for .bashrc

    The syntax to add to the .bashrc file would be like this
    Code:
    export PATH=$PATH:/new/path:/another/new/path:.
    the $PATH means add to the already given path, and new entries are separated by a colon. The dot at the end adds the current working directory also to the path.

    If you wish to also add it for the csh, you can add the following to .cshrc (or .tcshrc, doesn't matter which)
    Code:
    set path = ( $path /new/path /another/path .)
    Hope this helps.

  3. #3
    ab@novell.com NNTP User

    Default Re: adding directory to PATH?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    export PATH=$PATH:/path/to/new/directory

    You can put this line, with the directory of your choice on the end, in
    ~/.bashrc or ~/.profile, yes. Also be sure you never put the current
    directory in there as '.' as that's a bit of a security no-no.

    Good luck.





    PattiMichelle wrote:
    > What's the syntax to add a directory to my path search for calling
    > executables from the command line? (I think this would be a mod for
    > .bashrc and .tcshrc)
    >
    > Thank You!
    > PattiM
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFI1ueY3s42bA80+9kRAtF2AJ42yMQPgZRWLw5sshQ4UfHoU7HbqwCfV5nU
    e8muwAWD/M8VS0gfU0T3uGA=
    =BSSJ
    -----END PGP SIGNATURE-----

  4. #4
    Join Date
    Jun 2008
    Location
    Sarasota
    Posts
    301

    Default Re: adding directory to PATH?

    Quote Originally Posted by ab@novell.com View Post
    Also be sure you never put the current
    directory in there as '.' as that's a bit of a security no-no.
    Seems safe to me, as long as you put it LAST,
    as the previous poster shows.
    Box1: MEPIS-8.5/sidux/openSUSE-11.3M6(broken-wifi/hiddenSSIDs)/XP(32-bit), nvidia 5200
    Lap1: antiX-8.5(KDE4.4.3)/MEPIS-8.5/Vista, Intel 945GM, builtin-wifi->Broadcom-4311(drv=wl)

  5. #5
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,175

    Talking Re: adding directory to PATH?

    Thank you very much!! I use bash, of course, but I also have to use tcsh from time to time to run some special software I have. I have installed some software from the openSuSE repo (openMPI), but it created all the files in a bin subdirectory without making any links to /usr/local/bin (or any other default directory on the path). So I'm just going to add the path

    Patti

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

    Default Re: adding directory to PATH?

    If you are compiling stuff for MPI, keep in mind that you may also have to add the libraries to the library path. The environment variable you want to change in this case is
    Code:
    LD_LIBRARY_PATH
    So, for example on my system (64 bit and using Intel MPI instead of openMPI)
    Code:
    export LD_LIBRARY_PATH="/opt/intel/mpi/3.0/lib64:$LD_LIBRARY_PATH"
    Yours will probably be in a different location.

  7. #7
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: adding directory to PATH?


    all of that is true, but also if you install a new library, you need
    to run ldconfig to rescan the libraries. it makes a giant 'hash
    table' which lets linux link libraries faster during compiling


    --
    DenverD (Linux Counter 282315) via NNTP, Thunderbird 2.0.0.14, KDE
    3.5.7, SUSE Linux 10.3, 2.6.22.18-0.2-default #1 SMP i686 athlon

  8. #8
    Join Date
    Jun 2008
    Location
    Prescott, AZ
    Posts
    1,175

    Default Re: adding directory to PATH?

    I just wanted to say, again, a big THANK YOU!!! I was really confused by the need to set LD_LIBRARY_PATH - but once I did this, it seems to work fine. I also wasn't sure if starting tcsh under bash would pick up the LD_LIBRARY_PATH, and I don't know enough linux command-line to trouble-shoot path variable problems. But it did pick it up so YAY!!!

  9. #9
    Join Date
    Jun 2008
    Location
    The Netherlands
    Posts
    1,273

    Default Re: adding directory to PATH?

    Quote Originally Posted by ab@novell.com View Post
    You can put this line, with the directory of your choice on the end, in ~/.bashrc or ~/.profile, yes.
    To set this as a system wide path for all and everyone.. would the correct thing be to create a profile.local in /etc?
    Have a lot of fun!

Posting Permissions

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