Skip to content

Linux: what is link

I’m new in Linux I’m just using windwos GUI before but I have a question: what is LINK in Linux? I know it have tow type but I don’t know what is the advantage of them normally in windows has shortcut to reference app from the difference path if LINK in Linux have the same feature why it have tow type?

Thank you to answer.



First You should be know what is Inode ? to understand advantage of link type let me

An inode is an entry in inodetable, containing information ( the metadata ) about a regular file and directory. An inode is a data structure on a traditional Linux file system such as ext3 or ext4. Inode number also called as index number , it consists following attributes.

  • File types ( executable, block special etc)
  • Permissions ( read, write etc)
  • UID ( Owner )
  • GID ( Group )
  • FileSize
  • Time stamps including last access, last modification and last inode number change.
  • File deletion time
  • Number of links ( soft/hard )
  • Location of file on harddisk.
  • Some other metadata about file.

to Display Inode use this command+flags

ls –il

What is a link?

A link is simply a way to refer to the contents of a file.

Types of link:

  1. Hardlink(Another name for the file/inode in the disk)
  2. Softlink/symbolic link (Pointer to the file location)

How to create Links in linux ?

  1. Hard link ln existingfile newfile

    Note : Hardlinksare not allowed for directories

  2. Soft link ln –s existingfile newfile

A soft link will have a different Inode number than the source file, which will be having a pointer to the source file but hard link will be using the same Inode number as the source file. Soft link is like shortcut in windows. It doesn’t contain any information about the destination file or contents of the file, instead of that, it simply contains the pointer to the location of the destination file. Soft Links You can make links for files & folder & you can create link (shortcut) on different partition & got different inode number from original. If real copy is deleted the link will not work. Hard Links For files only & you cannot create on different partition ( it should be on same partition ) & got same inode number as original If therealcopy is deleted the link will work( because it act as original file )

User contributions licensed under: CC BY-SA
4 People found this is helpful