Jump to content

Cheatsheet: Difference between revisions

Line 679:
* A link is a pointer to another file.
* There are two types of links:
<br />
 
;Symbolic links (or Soft Links)
Line 697 ⟶ 698:
* The original file is just a name that is connected directly to the inode, and the symbolic link refers to the name.
* The size of the symbolic link is the number of bytes in the name of the file it refers to, because no other information is available in the symbolic link.
<br />
 
;Hard links
 
* The identity of a file is its inode number, not its name.
* A hard link is a name that references an inode.
* It means that if file1 has a hard link named file2, then both of these files refer to same inode.
* So, when you create a hard link for a file, all you really do is add a new name to an inode.
*there is no difference between the original file and the link: they are just two names connected to the same inode.
 
* Create a Hard link:
ln /home/bob/sync.sh synchro
 
*Compare:
ls -il /home/bob/sync.sh synchro
517333 -rw-r----- 2 root root 5 Apr 7 06:09 /home/bob/sync.sh
517333 -rw-r----- 2 root root 5 Apr 7 06:09 synchro
 
*The directories cannot be hard linked as Linux does not permit this to maintain the acyclic tree structure of directories.
*A hard link cannot be created across filesystems. Both the files must be on the same filesystems, because different filesystems have different independent inode tables (two files on different filesystems, but with same inode number will be different).
 
== Hosts file ==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.