Hi, have you ever wondered what does
.. refer to when you
ls -l into a directory in Linux?
In this post, I will try to explain to you what people mean when they say
. refers to the current directory and
.. refers to parent directory (one level above).
In this case, I have created a directory called
testfor demonstration purposes that is empty for now.
[[email protected] Documents]$ mkdir test[[email protected] Documents]$ ls -la testtotal 0drwxrwxr-x. 2 tux tux 6 Apr 23 21:12 .drwxr-xr-x. 3 tux tux 18 Apr 23 21:12 ..
-i option refers to the inode number that identifies one file from another.
Observe the inode number (i.e. 1550977) on the left of both of the files. And, the number 2 in this case represents amount of inodes in this directory.
Almost everything is a file in Linux
A directory is a special type of file in Linux
An inode represents the metadata of a file/directory.
Did you know you can figure out the subdirectory count of a directory without going inside of the directory?
The number 119 represents the total number of inodes and if you subtract by 2 (. and ..) then you will get 117 subdirectories inside it. Always remember to substract by 2.
Learn more about difference between hard links and symbolic links.