In Unix, what is a symbolic link, and how do I create one?
A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system. This difference gives symbolic links certain qualities that hard links do not have, such as the ability to link to directories, or to files on remote computers networked through NFS. Also, when you delete a target file, symbolic links to that file become unusable, whereas hard links preserve the contents of the file.
To create a symbolic link in Unix, at the Unix prompt, enter:
ln -s source_file myfile
source_file with the name of the existing file for which you want to create the symbolic link (this file can be any existing file or directory across the file systems). Replace
myfile with the name of the symbolic link. The
ln command then creates the symbolic link. After you've made the symbolic link, you can perform an operation on or execute
myfile, just as you could with the
source_file. You can use normal file management commands (e.g.,
rm) on the symbolic link.
For more about symbolic links, see the man pages for the
ln command. At the Unix prompt, enter
At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?
This is document abbe in the Knowledge Base.
Last modified on 2016-12-06 11:10:56.
- Fill out this form to submit your issue to the UITS Support Center.
- Please note that you must be affiliated with Indiana University to receive support.
- All fields are required.