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:

Wrong:

# unlink myDirectory/

Correct:

# unlink myDirectory
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 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.

2 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

Leave a reply