how to create symlink?
August 12th, 2006 mysurface Posted in Admin, ln | Hits: 331520 | 17 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.







August 30th, 2006 at 1:57 am
[...] 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. [...]
December 10th, 2006 at 1:45 am
[...] Check out more about symlink at here. [...]
April 26th, 2007 at 3:36 am
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
October 4th, 2007 at 9:38 am
thanks for this tip, you saved my hour…
Eliena Andrews
http://www.visitformoney.blogspot.com
February 5th, 2009 at 1:42 am
[...] 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 [...]
June 5th, 2010 at 12:00 am
Is there a way to move a directory and leave a symlink to it in the original spot?
June 16th, 2010 at 1:34 am
@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.
July 27th, 2010 at 10:35 pm
Can I create a symlink for a windows drive in my linux box?
January 4th, 2011 at 3:09 am
Cool! thanks ^^
February 10th, 2011 at 12:17 pm
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
May 18th, 2011 at 7:37 pm
Superowo, winszuj? stronki, buziaki!!!!!!!!
October 12th, 2011 at 4:17 pm
Fajny blog, zrobi? sobie subskrypcj? rss :)
October 12th, 2011 at 4:39 pm
Cool blog. Greetings from Poland
September 5th, 2012 at 6:09 pm
Very useful site :)
March 22nd, 2013 at 9:13 am
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.
April 15th, 2013 at 12:38 pm
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.
May 16th, 2013 at 10:08 am
[...] like you want symlinks http://linux.byexamples.com/archives…reate-symlink/ [...]