LFCS and LFCE: File links


Considering that you are already familiar with exploring the file system, there is one type of file that we did not covered yet. This files are the File links. 

ls -l /usr/bin

So, a short explanation it will be that are an important feature of working with files on Linux. A link is a reference to a file in a different place - so basically a "shortcut".

There are two kind of links: 

  • Hard Links -> shows as regular file
  • Soft (Symbolic) Links -> shows as "shortcut"

Considering having a file name mydata.txt this file is stored on the disc in a series of data blocks. And the location of thoese are stored in a structure called inode. And at the end the file system associates the name of the file in its index of file with the data in that inode. 

Example:

So as a pratice I created the file mydata.txt and inside I wrote a few names. In case I would like to access this document from my documents directory, as well as from my home directory, 


ln -s /home/UBUNTU/mydata.txt Documents/user-list.txt

Important: replace on the command above the parts that are marked with red colour, with the correct ones based on your own user name and the name of the file that you created. 


Comments

Leave as a comment:

Archive