Live Chat!

how to create symlink?

* * * * * 3 votos

August 12th, 2006 mysurface Posted in Admin, ln | Hits: 22287 |

First of all symlink stand for symbolic link, which is a very useful files like shortcuts in windows. Let me make few scenario why you need symlink.

Sometime, we want to goes to a directory which is very long and difficult to remember, for example /var/www/html/BLOG/Image/Archive/_icon. And you have to access to that directory oftenly after you login as root. What do you do to make your life easy? You can create a symlink in root home directory which is /root, like:

ln -s  /var/www/html/BLOG/Image/Archive/_icon /root/icon

You are creating a symlink call icon at /root which links you to /var/…._icon. Now you can easily go to _icon directory by

#assume you now at /root

cd icon

 

The second scenario where I create a symlink to my bash script where I store my symlink to /usr/local/bin.

I have write a sort of bash scripts to help me manipulate my work and I store them into a directory call sh. So everytime I want to run my script i have to go to sh directory and ./something.sh, which is very inefficient. so I create symlink and store at /usr/local/bin

ln -s /home/myname/sh/runme.sh /usr/local/bin/runme

So that when I want to run that script, I can just run it like other commands without specified ./ Another good thing is I can edit my scripts without relink or recreate the symlink, the changes will be reflects to the symlink automatically.

4 Responses to “how to create symlink?”

  1. [...] If you have directory symbolic link to lead you to certain directory, you may notice that when you change directory to symlink directory, the path will be symlink by default. [...]

  2. [...] Check out more about symlink at here. [...]

  3. Great explanation really helped me create a symlink for a ruby on rails installation on my web host. Don’t have access to my apache_conf so needed away to relink my public folder and my knowledge of sys-admin is intermediate

  4. thanks for this tip, you saved my hour…

    Eliena Andrews
    http://www.visitformoney.blogspot.com

Leave a Reply