2.4 Symlinks
We are going to make links between files so that 1 file can be accessed from multiple locations.
become root
We are first going to create a hard link for the file /usr/share/doc/vim-common/README.md and we are going to link it to /root/manual.txt. We are going to use the ln (link) command for this.
ln
Examples on how to do this:
ln /usr/share/doc/vim-common/README.md /root/manual.txt
Use ls -l to check the link count, It should look something like this
-rw-r--r--. 2 root root 4689 Oct 15 2012 manual.txt
Verify the link count on the original file /usr/share/doc/qrencode-libs-3.4.1/README
ls -l /usr/share/doc/vim-common/README.md
It should look like this:
-rw-r--r--. 2 root root 4689 Oct 15 2012 /usr/share/doc/vim-common/README.md
Now we are going to practice with creating a symbolic link. To create a symbolic we will need to use -s (symbolic) together with the ln command.
Go ahead and link create the symbolic link /root/tmpdir and make it point to /tmp
ln -s /tmp /root/tmpdir
You can again verify the result with the below command:
ls -l /root