How to create and remove a soft link, symlink or symbolic link
A soft link, or more common, a symlink, is link a shortcut to the targeted file or directory. So when is removed the original target stays present. This is the opposite of a hard link which is a reference to the target and so, if the hard link is removed, so is the target.
A symlink can be created like:
ln -s /path/ linkname
from the ln man pages:
ln [OPTION]… [-T] TARGET LINK_NAME (1st form)
-s, –symbolic
make symbolic links instead of hard links
to remove a symlink
rm linkname
What is important here is to note that the command doesn’t have the trailing slash
$ rm linkname/
will output the error:
rm: cannot remove `linkname/': Is a directory
$ rmdir linkname/
will output:
rmdir: linkname/: Not a directory
So it’s a directory or not?? i guess different tools have different ways of looking at this. Isn’t GNU/Linux great?!

[...] Nerdica wrote an interesting post today onHere’s a quick excerptA soft link, or more common, a symlink, is link a shortcut to the targeted file or directory. So when is removed the original target stays present. This is the opposite of a hard link which is a reference to the target and so, if the hard link is removed, so is the target. A symlink can be created like: ln -s /path/ linkname from the ln man pages: ln [OPTION]… [-T] TARGET LINK_NAME (1st form) -s, –symbolic make symbolic links instead of hard links [...]
Linux Code and More » Blog Archive » How to create and remove a soft link, symlink or symbolic link
November 15, 2007
[...] see in this post how to create a symlink so, everytime you change this file you don’t need to copy it to the [...]
How to start a new X server with Quake wars to work as a minimizer « The GNU of Life, the Universe and Everything
November 15, 2007
What is important here is to note that i doesn’t have the trailing slash
what is i?
Whose name
April 22, 2008
Thanks “Whose name” for the heads up.
“i” should be “it” which is “the command”.
hope it makes sense
Pedro Carvalho
April 22, 2008
[...] under your dropbox folder. Solution, symbolic links. SymbolicLinker is a cool plugin for creating symbolic links using Finder from the right click menu. Place the links in your Dropbox folder to backup the [...]
Dropbox with symbolic links in finder | digiculturetravelexpatasia
September 15, 2008
hey buddy use unlink instead of rm command
unlink linkname
Badi Ul Zaman
MCSE,RHCE,JNCIS
bnhashmi@yahoo.com
Badi Ul Zaman
December 4, 2008
hei there buddy!
thanks for the tip but in most GNU Linux Systems rm uses unlink to remove files so unlink will run into the same problems.
Pedro Carvalho
December 4, 2008
Your problem is that you’re using tab completion, which automatically appends a ‘/’ to the end of your symlink. Syntactically, this appears to be a directory to rm. If you simply say “rm linkname” (without any trailing slash), the command will work.
Brian Stempin
April 10, 2009
Thank you very much! I was having an awful job trying to remove the the symlink and it was as simple as getting rid of the trailing slash. You’ve saved me some hair-pulling. Thanks again.
sislii
May 20, 2009
# this works
rm linkname
# versus
rm linkname/
Basically you need to tell it its a file not a dir (/)
Brian
June 17, 2009
try “rm linkname” instead of “rm linkname/”
a2j
July 5, 2009