Dereference Symlinks
If we provide the symbolic link file to the stat command, then it will give the information about the symbolic link instead of the original file. Here is one example:
Now let’s see how we can dereference Symlinks. To follow or dereference the symbolic and display information about the file of which the symbolic like point stat provide -L (–dereference) option. We can use this option to dereference the symbolic links. Here Example:
stat -L /etc/localtime
The output will be like this:
We can see that stat is showing information about the /bin folder.
Stat command in Linux with examples
The stat is a command which gives information about the file and filesystem. Stat command gives information such as the size of the file, access permissions and the user ID and group ID, birth time access time of the file. Stat command has another feature, by which it can also provide the file system information. This is the best tool to use when we want the information of any file.
Now let’ see one by one how can we use the stat command.