Linux - Stat (File status)

About

This page is about the file metadata (also known as file status) on the linux file system

Principally, the stat command display the file metadata.

The find command uses this command to collect its data.

The stat command is simply a frontend to the stat() system call. See the following man page

man 2 stat

Syntax

stat [OPTION] FILE...

where:

  • Through the --printf=FORMAT option a lot information are available, see the man page

Example

File

stat testFile.txt
  File: `testFile.txt'
  Size: 4               Blocks: 8          IO Block: 4096   regular file
Device: ca02h/51714d    Inode: 2522975     Links: 1
Access: (0644/-rw-r--r--)  Uid: (  500/  oracle)   Gid: ( 1001/oinstall)
Access: 2015-09-15 13:50:26.000000000 +0200
Modify: 2015-09-15 12:43:18.000000000 +0200
Change: 2015-09-15 12:43:18.000000000 +0200

where:

File System

stat -f testFile.txt
  File: "testFile.txt"
    ID: f6b940611a2fbb15 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 12427805   Free: 9800360    Available: 9159378
Inodes: Total: 12518912   Free: 12381458

Powered by ComboStrap