7:36 PM STAT command : check file or filesystem statistics |
STAT command : It is used to show the statistics of a file or filesystem in Linux Format stat [OPTION] FILE/FILESYSTEM... DESCRIPTION -f, --file-system -c --format=FORMAT --printf=FORMAT -t, --terse Examples: 1. Display the statistics of root directory "/"
Here the fields which are shown in the output for a file statistics Size: size of file in bytes Blocks: no of blocks occupied Type of file: directory/file Acces time: last access timestamp Modify: time stamp of last modification Change:time stamp of last changes Uid: User id of the user Gid : Group id of the group And below are the fields for filesystem statistics: ID : file system id in hexadecimal Type : Type of filesystem Eg. nfs, ext2/3, tmpfs, sysfs, proc etc. Free/Available/Total: available/free/total memory Block size: block size Inodes: number of indoes free/total 2. Display the statistics of file system "/"
3. Check the statistics of a NFS Filesystem "/nfs/app/mint"
4. Check the status a file "sent"
5. Print the status of a file in terse form See the comparision of below two outputs:
6. We can print the statistics in our desired format also using --format option. See below examples:
7. Show the types of all the filesystems in root folder
Following are the valid format sequences for files (without --file-system): %a Access rights in octal %A Access rights in human readable form %b Number of blocks allocated (see %B) %B The size in bytes of each block reported by %b %C SELinux security context string %d Device number in decimal %D Device number in hex %f Raw mode in hex %F File type %g Group ID of owner %G Group name of owner %h Number of hard links %i Inode number %n File name %N Quoted file name with dereference if symbolic link %o I/O block size %s Total size, in bytes %t Major device type in hex %T Minor device type in hex And for filesystem, below are the formats that can be used: Valid format sequences for file systems: %a Free blocks available to non-superuser %b Total data blocks in file system %c Total file nodes in file system %d Free file nodes in file system %f Free blocks in file system %C SELinux security context string %i File System ID in hex %l Maximum length of filenames %n File name %s Block size (for faster transfers) %S Fundamental block size (for block counts) %t Type in hex %T Type in human readable form
|
|
Related blogs
You may also like to see:
[2014-10-04] | [Open System-Linux] |
SYSCTL : A command to configure kernel parameters at runtime in linux |
[2014-12-28] | [Open System-Linux] |
Shift command with examples |
[2015-08-18] | [Open System-Linux] |
How to open a PDF file or a Postscript file in Linux - Evince Document viewer? |
[2014-03-25] | [Open System-Linux] |
Create a new user in Linux system: useradd |
[2014-09-20] | [Open System-Linux] |
Export command in Linux |
Total comments: 0 | |