Find the answer to your Linux question:
Results 1 to 8 of 8

Thread: how to set path

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    how to set path

    I google the internet about how to set the path for my new program. Frankly, I feel confused. It seems that there are different methods, and I don't know which one to trust ( I don't want to damage my current settings).

    Basically, what i want is to add the new program directories to the default search path. I prefer to use C-shell ( my default shell is bourne shell, i think, and i have to type csh to change to C shell). I looked my .cshrc file. It is pretty simple, only two sentences that I myself created for another program (under the instruction provided by that program). there is no word like "SETENV", "PATH". I don't know how to add the path for my new program. Do I have to be the root?

    Can anyone suggest a general method? Thanks! ( I am using Suse 10.0)

  2. #2
    Just Joined!
    Join Date
    Mar 2007
    Newcastle, Australia
    Probably the easiest thing is to add you $PATH that you wish to speciy in your bashprofile. Your bashprofile is usually in your home dir so /home/user/.bashprofile so
    kate ~/.bash_profile
    would do it, Kate being my choice of editor.

    here is mine

    # .bash_profile

    # Initialize keychain if needed
    if [ -r $HOME/.ssh/identity -o -r $HOME/.ssh/id_dsa -o -r $HOME/.ssh/id_rsa ]; then
    if [ ! -d $HOME/.keychain ]; then

    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc

    # User specific environment and startup programs


    export PATH
    unset USERNAME
    As you can see I added python to mine.

    Hope this helps

  3. #3


    Thanks. Are you doing this as user or root?

  4. $spacer_open
  5. #4
    Just Joined!
    Join Date
    Mar 2007
    Newcastle, Australia
    Yes no you need to work as root.

  6. #5
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    West Yorks
    I think this article may help you out.

  7. #6
    If you want to have a system variable set (available to all users) then add what flebber suggested under /etc/profile (at the end of the file) and run as root:
    source /etc/profile


  8. #7
    yep, that's a good way to go about doing it.

  9. #8



    Use one of the following lines in your '.cshrc' file (depending on where in the path you want your directories):

    set path = ( <*> $path )
    set path = ( $path <*> )
    <*> = "list of one or more paths separated by spaces"
    Also, you do not need to be root -- just edit your '.cshrc' file as a normal user...

Posting Permissions

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