Displaying the File System Information
stat command can provide the file system information when we provide file name with the -f (–file-system) options. Syntax of using the -f option with the stat command:
stat -f filename
Here is one example of the -f option :
We can also provide the directory or file system as an input to the stat command as follows:
stat -f /
The information we get for the filesystem from the stat
- File: The name of provided file.
- ID: File system ID in hexadecimal format.
- Namelen: The maximum length (number of characters) of a file name.
- Fundamental block size: Total size of each block on the file system.
- Blocks:
- Total: Total number of blocks in the file system
- Free: Total number of free blocks in the file system
- Available: Total number of free blocks available for non-root users
- Inodes:
- Total: Total number of inodes in the file system.
- Free: Total number of free inodes in the file system.
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.