Hard and Symbolic links on Linux
What is Linux?
Just like Windows, iOS, and Mac OS, Linux is an operating system. In fact, one of the most popular platforms on the planet, Android, is powered by the Linux operating system. An operating system is software that manages all of the hardware resources associated with your desktop or laptop. To put it simply, the operating system manages the communication between your software and your hardware. Without the operating system (OS), the software wouldn?t function.
what are hard and symbolic links on Linux ?
A soft link does not contain the data in the target file.
A soft link points to another entry somewhere in the file system.
A soft link has the ability to link to directories, or to files on remote computers networked through NFS.
Deleting a target file for a symbolic link makes that link useless.
A hard link preserves the contents of the file.
A hard link cannot be created for directories, and they cannot cross filesystem boundaries or span across partitions.
In a hardlink you can use any of the hardlink names created to execute a program or script in the same manner as the original name given.
How to create a hard links in Linux or Unix
To create a hard links on a Linux or Unix-like system:
领英推荐
How to Create Symbolic Links
To use the ln command, open a terminal window and enter the command with the following format:
ln [-sf] [source] [destination]
For example, create a symbolic link with:
ln -s test_file.txt link_file.txt
This creates a symbolic link?(link_file.txt)?that points to the?test_file.txt.
To verify whether the symlink has been created, use the ls command:
ls -l link_file.txt
the difference between hard and symbolic links on linux