Results 1 to 9 of 9

Thread: symbolic links

  1. #1
    Join Date
    Mar 2007
    Location
    Murfreesboro, TN
    Beans
    388
    Distro
    Ubuntu

    updating path

    Hello all,
    I've got a compiler I'd like to be able to reference from any directory on my system by just using the file's name and not it's whole directory path. I think what I'm talking about would be called a symbolic link. How can I set this up?
    Last edited by woodsonoversoul; March 8th, 2010 at 09:05 PM.

  2. #2
    Join Date
    Dec 2009
    Beans
    44

    Re: symbolic links

    ln -s
    Last edited by steindor2; March 8th, 2010 at 08:46 PM.

  3. #3
    Join Date
    Mar 2007
    Location
    Murfreesboro, TN
    Beans
    388
    Distro
    Ubuntu

    Re: symbolic links

    Thats what I thought, but when I enter:
    Code:
    ln -s /home/dan/go/src/cmd/8g/8g 8g
    to make it so that I just have to type 8g <filename> to compile, wherever I am, I get:
    Code:
    8g: command not found
    What gives?

  4. #4
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,675
    Distro
    Ubuntu

    Re: symbolic links

    Are you sure you want a symbolic link and not an update to your path?

    Do you want to be able to run your compiler program from within a terminal, regardless of the current directory? That sounds more like a path update. A symbolic link makes a file or directory appear in a different place or under a different name.

  5. #5
    Join Date
    Mar 2007
    Location
    Murfreesboro, TN
    Beans
    388
    Distro
    Ubuntu

    Re: symbolic links

    yes, then that's what I want to do, update my path...

  6. #6
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,675
    Distro
    Ubuntu

    Re: symbolic links

    In that case, try:

    $ export PATH=$PATH:<path_to_your_program>

    If that works, there are a multitude of ways of making it permanent, depending on what you want.

    Adding the above line to ~/.bashrc is a start, then read the options here:

    http://ubuntuforums.org/showthread.php?t=2793

  7. #7
    Join Date
    Mar 2007
    Location
    Murfreesboro, TN
    Beans
    388
    Distro
    Ubuntu

    Re: symbolic links

    Will I need to restart the terminal?

  8. #8
    Join Date
    Mar 2007
    Location
    Murfreesboro, TN
    Beans
    388
    Distro
    Ubuntu

    Re: symbolic links

    I added:
    Code:
    $export 8g=$HOME/go/src/cmd/8g/8g
    to the end of ~/.bashrc

  9. #9
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,675
    Distro
    Ubuntu

    Re: symbolic links

    Sorry, I perhaps didn't make it completely clear. PATH is the variable that defines the path. So you need something like:

    $ export PATH=$PATH:$HOME/go/src/cmd/8g/

    That assumes your program 8g is in the directory $HOME/go/src/cmd/8g.

    Then you should just be able to type:

    $ 8g

    I'm assuming that the 8g file is already executable. If not, go to $HOME/go/src/cmd/8g and type:

    $ chmod u+x 8g

Tags for this Thread

Bookmarks

Posting Permissions

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