This article will show you how to create and delete symbolic links on a Linux system such as Ubuntu, Red Hat, and other Linux distributions. A symbolic link is basically a file that points to another file. Note that there is only 1 copy of the actual file on the hard disk, thus saving valuable hard disk space by simply creating a link to it.
Creating a Symbolic Link in Linux
To create a symbolic link, use the syntax:
ln -s [directory or file to link] [the path of the new link]
For example, to create the link (or shortcut) /logs/mongrel.log that points to the actual file /usr/local/bin/mongrel/logs/mongrel.log, use the syntax:
ln -s /usr/local/bin/mongrel/logs/mongrel.log /logs/mongrel.log
Now, each time you want to view the mongrel.log file, you do not have to navigate to the original long path, simply go to the /logs folder
Note: You must create the /logs folder prior to creating the symbolic link
Removing/Deleting a Symbolic Link in Linux
Deleting a symbolic link is the same as removing a real file or directory. Simply use the command:
Note: Deleting the symbolic link does not delete the actual file, it only removes the link.
3 thoughts on “How to create/remove symlinks (symbolic link) in Linux”
use unlink command for remove symbolic link
# unlink then link name
Thanks for providing the useful article on Removing symbolic links in linux
Thank you for the useful info published on this article…