Linux / UNIX advantage of creating soft links instead of copy a file

Q. What is the main advantage of creating soft / hard links to a file instead of copies of the file?

ADVERTISEMENTS

A. To make links between files you use ln command. To copy a file you use cp command. The main advantage is access permission. If you want to change the permissions for a a file called foo, you only have to do it on the original. With copies you have to find all of the copies and change permission on each of the copies.

Other advantages :

[a] Create a shortcut for example /webroot/home/httpd can be soft linked at /home/httpd

[b] Ease of management

[c] Save disk space etc

Please note that the link will show permissions of lrwxrwxrwx but that is for the link itself and not the access to the file.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.