How to Create a Symbolic Link in Unix (aka Shortcut)

ln -s sourced_from sym_link

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 sourced_from sym_link
  • sourced_from is the file or folder
  • sym_link is name of the name of the symbolic link (aka shorcut) you want to create
Replace sourced_from with the name of the existing file or path for which you want to create the symbolic link (this file can be any existing file or directory across the file systems). Replace sym_link 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 sym_link, just as you could with the sourced_from. You can use normal file management commands (for example, cp, rm) on the symbolic link.
Note:
If you delete the source file or move it to a different location, your symbolic file will not function properly. You should either delete or move it. If you try to use it for other purposes (for example, if you try to edit or execute it), the system will send a "file nonexistent" message. For more about symbolic links, see the man pages for the ln command. At the Linux / Unix prompt, enter man ln.

Comments

  1. Asian Poker - Asian casino - Bogiadinh123
    Asian poker - Asian casino. Our online casino offers many types of gambling like 온카지노 video poker, and 12bet traditional Chinese games. You can also find the best m88 ทางเข้า offers

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Customize Login Message in Linux with System Status Info

Quickly Load Very Large Data Sets into Your MariaDB Database