Friday 2 August 2019

Linux - Soft links

Soft links in Linux/UNIX flavors is similar to a shortcut in windows. When we access the soft link file, it will redirect to the original file.
The main use of it is to access a particular file multiple times and by multiple users, which is not present in the present working directory.
Practical usage,
                Talk about any practical files already available in /bin or /sbin or /etc linked files.

Important notes on soft links: 
Soft link file size and original file size is different.
The inode number is different for soft link file and original file.
If we remove soft link file, we can access data through an original file.
 
Syntax :
ln –s actual-file soft-link-file

For example: 
[root@sys2 ~]# ls -l abclearn
-rw-r--r--. 1 root root 16 Jan 28 19:55 abclearn 
[root@sys2 ~]# ln -s abclearn abcsoft

[root@sys2 ~]# ls -l ab*
-rw-r--r--.    1 root root 16 Jan 28 19:55 abclearn
lrwxrwxrwx. 1 root root  8 Jan 28 19:56 abcsoft -> abclearn

In the above output,
The highlighted portion indicates the permissions to that linked file.
The starting letter ‘l’ indicates that it is a soft link file.

0 comments:

Post a Comment