how to create symlink?

August 12th, 2006 mysurface Posted in Admin, ln | Hits: 403875 | 49 Comments »

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.

49 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

  5. [...] this file in /usr/lib, /usr/share/lib or /lib. Bare in mind, libncurses.so.5 probably is just a symbolic link, you need to copy the real .so instead of its [...]

  6. Is there a way to move a directory and leave a symlink to it in the original spot?

  7. @Olin,
    Symlink s just literally point linked file( or directory). deleting/moving the directory is unknown to the literally pointing link file.

    So the link will be pointing to orignial location even after moving. Even more, if you delete / move the direcotry and create a file (say simple text file or whatever) with the deleted/moved name , the original link can become active and used to view the file with linked name.

  8. Can I create a symlink for a windows drive in my linux box?

  9. Cool! thanks ^^

  10. Tutto il materiale contenuto su questo sito è considerato freeware, cioè gratuito e per questo liberamente usabile. Se qualcuno volesse contribuire, a sostegno del sito, potrà farlo donando una qualsiasi cifra tramite il pulsante PayPal qui sotto, è sicuro, facile e veloce… ed io apprezzerò molto. Grazie

  11. Superowo, winszuj? stronki, buziaki!!!!!!!!

  12. Fajny blog, zrobi? sobie subskrypcj? rss :)

  13. Cool blog. Greetings from Poland

  14. Very useful site :)

  15. SteveP1975 Says:

    Hi, I have wordp ress hosted on home server,located at /dir/sub/sub .I want to allow visitors access to files on /dir2/sub/ .These files are to large to upload these files to the /dir/sub/sub/wp-content/uploads . So i want to link /wp-content to /dir2/sub . Is this as simple as cd /wp-content/uploads , ls -s /dir2/sub /uploads ? Or am I missing something else? Whatabout ownership? /wp-content/ is owned by www-data ,where as /dir2/ is owned by root?Any advice is nice. I’m a noob, been working on this as a learning project, have samba,cups,apache2 working of same machine. This isn’t production, it’s a personal project. But I plan to have it web accessable when done. Thanks again. P.s I’m sorry if this isn’t posted in the proper place.

  16. Excellent post. I was checking constantly this blog and I am impressed!
    Very useful info specially the last part
    :) I care for such information a lot. I was seeking this certain info for a very long time.

    Thank you and good luck.

  17. [...] like you want symlinks http://linux.byexamples.com/archives…reate-symlink/ [...]

  18. It’s going to be ending of mine day, except before ending I am reading this great piece of writing to improve my knowledge.

  19. [...] a symlink pointing to /var/uploads (tutorial here) [...]

  20. Yes its works for me.. Thxs for this guide of symlink

  21. May we using this trick for insert link??

  22. Surely this works trick.Thxs for write this trick

  23. Like an webmaster we are here to solve problem

  24. Yes its works for me to

  25. thanks for the tutorials ..
    http://cdexsw.blogspot.com/

  26. It’s going to be ending of mine day, except before ending I am reading this great piece of writing to improve my knowledge.

  27. Excellent post. I was checking constantly this blog and I am impressed!
    Very useful info specially the last part
    :) I care for such information a lot. I was seeking this certain info for a very long time.
    Thank you and good luck.

  28. Thank you so much for the information you have shared with us!
    I am impressed!

  29. Excellent post. I was checking constantly this blog and I am impressed! useful information. thanks for sharing.

  30. slamet suka gaya loe

    seo gratis

  31. banten merdeka

    ratu atut tersangka

  32. Don’t have access to my apache_conf so needed away to relink my public folder and my knowledge of sys-admin is intermediate

  33. Se qualcuno volesse contribuire, a sostegno del sito, potrà farlo donando una qualsiasi cifra tramite il pulsante PayPal qui sotto, è sicuro, facile e veloce… ed io apprezzerò molto. Grazie

  34. I am glad for commenting to let you know of the remarkable experience my princess found visiting the blog.

  35. Don’t have access to my apache_conf so needed please help

  36. Se qualcuno volesse contribuire, a sostegno del sito, potrà farlo donando una qualsiasi

  37. I am glad for commenting to let you know of the remarkable experience my princess found visiting the blog.

  38. I am glad for commenting to let you know of the remarkable experience my princess found visiting the blog. Thanks

  39. Hi, simply wanted to say, I loved this post. It was actually inspiring. Continue on posting!

  40. yeah simply i love you :)

  41. Hi, simply wanted to say, I loved this post. It was actually inspiring. Continue on posting!

  42. Thanks for the tips, maybe I can use this svelte my noesis marketing and Ive been use whatsoever ethnical media in try a interaction and they eff handiwork a big friendliness on me.

  43. It is a pretty good post. This post contains useful information which helps us a lot.

  44. My spouse and I stumbled over here from a different website and thought I might check things out.
    I like what I see so i am just following you. Look forward to looking
    over your web page for a second time.

  45. It’s enormous that you are getting ideas from this post as well as from our discussion made at this place.

  46. ?i there, I ?ant too subscribe for this web site to gget newest ?pdates, therefore where can i
    do it please help out.

  47. Hey there our family representative! I have to point out that this article is awesome, fantastic created obtainable by using somewhere around many vital infos. I will appear added threads like this .

Leave a Reply