1. How to create a soft connection
LN -s/path/to/original/path/to/linkname
When we make changes to the soft connection file, the corresponding changes are also reflected in the original file (and vice versa).
When we delete a soft connection file, the original file does not make any changes.
When we delete the original file, the soft connection file still exists, but it points to a nonexistent file, a soft connection called a hanging connection.
2. How to Hard Connect software
Ln /path/to/original. file /path/to/link. file
3. The difference between soft and hard connections
Hard Connect:
- You can only connect to a file, not a directory.
- Cannot connect to a file, this file is on a different disk/volume.
- Although the file is moved, you can still connect to the file.
- The connection references the physical address on the hard disk.
Soft connection:
- Can be connected to a directory.
- Can connect files or directories, this file or directory in different hard disk/volume.
- If the original file is deleted, the connection still exists.
- If the original file is moved, the connection will not be able to reference the file.
- The connection references the abstract file name/directory, not the physical address. They have their own nodes.
Reference URL:
- https://www.nixtutor.com/freebsd/understanding-symbolic-links/
Soft and hard connections in Linux