Linux Stat Command detailed

Source: Internet
Author: User
Tags epoch seconds readable

The Linux Stat command is powerful, and we can learn more about the file based on the information listed in this command, the most basic of which is the time change of the file.

For example:

[Email protected] tmp]$ stat 123.log

File: "123.log"

size:24 blocks:8 IO block:4096 Normal file

device:802h/2050d inode:7077977 links:1

Access: (0755/-rwxr-xr-x) Uid: (501/metao) Gid: (501/metao)

access:2015-01-08 11:55:52.939370484 +0800

modify:2014-12-31 16:58:58.525116667 +0800

change:2015-01-08 11:54:50.765180227 +0800


Access: The time when the file was accessed. For example: more. However, cat does not change this time.

Modify: The time when the contents of the file changed. For example, if the contents of a file change, the time is changed.

Change: The file state changes time. ; For example: Chown,chmod will change this time.



The following references:

http://colinzhouyj.blog.51cto.com/2265679/1288580

The specific parameters of the Stat command are detailed below:


Stat

-L,--dereference follow links if it is a linked file, get the original file information
-Z,--context print the security context information if available
Print SELinux Security context information
-F,--file-system display file system status instead of file status
Displays the status of the file system where the file resides
-C--format=format Use the specified format instead of the default;
Output a newline after each use of FORMAT
Custom output format with line wrapping at the end
--printf=format like--format, but interpret backslash escapes,
And does not output a mandatory trailing newline.
If you want a newline, include \ n in FORMAT.
Custom output format with no line break at the end, manually added
-T,--terse print the information in terse form
Print output information in a concise form (without changing the output format)
--help Display this Help and exit
Printing Help information
--version output version information and exit
Print version information and exit

Optional file information output format
%a access rights in octal octal format
%A access rights in human readable form readable form (as shown in ls-l case)
%b number of blocks allocated (see%B) allocated blocks (value of unit reference%b)
%B the size in bytes of each block reported by%B
The size of each block (this value refers to the size of the cell block on the hard disk, which is different from the formatted block block size)
%d device number in decimal (10 binary)
%d Device number in hex (hex)
%f raw mode in hex raw (16 binary, can Baidu a bit of raw meaning)
%F file type
%g Group ID of the owner of the file
%G group name of the owner of the owners file
%h Number of hard links (the file itself counts as 1)
%i inode number Inode
%n File name File name
%N Quoted file name with dereference if symbolic link
Cancels the file name reference of a soft connection and becomes a normal string
%o I/O block size system formats block sizes
%s total size, in bytes file size (in units of byte)
%t Major device type in Hex major equipment types (hex)
%T Minor device type in hex secondary unit types (hex)
%u User ID of owner of the owner ID
%u user name of owner username
%x Time last access date
%x time last access as seconds since Epoch (epoch seconds)
%y time of last modification final modified (content changed)
%Y time of last modification as seconds since Epoch final modified (content changed)
%z time of last change (file attribute, permission owner, etc., format epoch seconds)
%Z time of last change as seconds since Epoch
Last change time (file attributes, permissions owner, etc., format epoch seconds)
Stat-c "%a%a%b%b%d%d%f%f%g%g%h%i%n%n%o%s%t%t%u%u%x%x%y%y%z%z" file
Optional partition information output format
%a free blocks available to non-superuser the number of blocks available to ordinary users
%b total data blocks in file system partition number of blocks
%c total file nodes in file system inode totals
%d free file nodes in file System idle Inode number
%f free blocks in file system number of blocks available
%c security context in SELinux selinux safety contexts
%i File System ID in hex partition ID (hex)
%l Maximum length of filenames partition filename maximum
%n File name File name
%s block size (for faster transfers) blocks (both size of system block)
%s Fundamental block Size (for block counts) Basic block sizes (all system block sizes)
%t type in hex file system types (formatted type, hex)
%T type in human readable form file system types (formatted type, readable form)
Stat-f-C "%a%b%c%d%f%c%i%l%n%s%s%t%t" file



This article from "for the Dream and strive!" "Blog, be sure to keep this provenance http://815632410.blog.51cto.com/1544685/1600626

Linux Stat Command detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.