Unlink or Remove a Symbolic link in Linux

Scenario / Question:

How to unlink or remove a symbolic in linux that was created with ln

Solution / Answer:

Use the unlink command

To unlink a symbolic link file :

# unlink symbolic_link_file

To unlink a symbolic link to a directory :

# unlink symbolic_link_dir

When unlinking a directory make sure that you do not include the trailing forward slash:


# unlink myDirectory/


# unlink myDirectory
Fabio Milano has written 80 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

3 Comments so far

  1. marcelo on February 11th, 2011

    thanks man.

  2. Asturiego on October 6th, 2011

    I get a message that says, “unlink: cannot unlink `/directory to unlink’: Is a directory

  3. China Mike on September 19th, 2012

    Asturiego, do not mess with this if you do not understand basic command instructions. You evidently typed the word “directory” instead of the actual NAME of your directory (i.e. foobar or myfolder12 or my_rap_music
    understand? you would write:
    unlink my_rap_music

    do NOT write:
    unlink my_rap_music/ <— do NOT put that SLASH in!!!

    hope that helped (I understand the post by Astruiego is old, but I just came across this!)

Leave a reply