Page 52 - RHEL8 BOOK
P. 52
LINK
HARD LINK SOFT LINK
Original and link file will Inode no. of the link file
have same inode no. will be different
It cannot be created It can be created across
across the partitions the partitions
If original file is deleted If original file is deleted
then also the link file will the link file will not be
be accessible accessible
Editing of original file will Editing of original file will
replicate in the linked file replicate in the linked file
Size of Hard link file is Size of Softlink file is
same as original file. smaller than original file.
Creating links whether hard or soft will be very helpful for admins and developers.
1. Create Files and Folders
[root@sun ~]# mkdir /myfolder
[root@sun ~]# cd /myfolder
2. Create a File
[root@sun myfolder]# cat > original_file
3. To see attributes of file
[root@sun ~]# ls –li original_file
4. Setting a soft link
[root@sun ~]# ln –s original_file softlink_file
5. To see attributes of file (softlink)
[root@sun ~]# ls –li
6. To see the contents of file softlink
[root@sun ~]# cat softlink
7. To add the data in softlink file
[root@sun ~]# cat >> softlink
8. To see the content in original_file
[root@sun ~]# cat original_file
9. To see attributes of file /myfolder/original_file
[root@sun ~]# ls –li /myfolder/original_file
10. Remove the original file
[root@sun ~]# rm /myfolder/original_file
11. Check to see the contents of softlink file
[root@sun ~]# cat softlink
S. Pradhan
(MCA, MBA-IT, BCA, CCNA, MCSA 2012, RHCE, ETHICAL HACKING)
Email Id:-spradhan.iiht@gmail.com
52