Thursday, 17 December 2015

Stat Command In Unix/Linux

Stat command is very helpful command to understand the file properties. it provides information in simplest way and much more readable than ls or ls -ltr command. We will see how to use and how to read the information provided by stat.

$ stat abc.txt
Output:
  File: `abc.txt'
  Size: 21              Blocks: 8          IO Block: 4096   regular file
Device: fd0ch/64780d    Inode: 1785        Links: 1
Access: (0600/-rw-------)  Uid: (23081988/  dwetl)   Gid: (23081988/  dwetl)
Access: 2015-12-17 01:14:33.890227923 -0500
Modify: 2015-12-17 01:14:39.128002707 -0500
Change: 2015-12-17 01:14:39.128002707 -0500

 Birth: 2015-12-17 01:14:33.890227923 -0500

Description:

We can see stat has displayed a lot of information regarding the file abc.txt
1. Size : Display the number of character available in the file.
2. File is a regular file.
3. Displayed the file permission and the user id along with group id.
4. The best part of stat is timestamp information. Stat displays the timestamp information in simplest manner.We can easily find it out the access/modify/change/update/Birth time of a file using stat command.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...