Get detailed status information for Linux file systems and files using the Stat command

Source: Internet
Author: User
Tags readable

Purpose:The stat command is used to display the status information of a file or file system, from the Coreutils software package, the general system comes with this command tool, which can obtain a lot of information related to the file system and files, the specific use of stat function options. This information includes Inode, Atime, CTime, Mtime, File (System) type, permissions, block size, symbolic connection, and so on.

syntax:stat [OPTION] ... FILE ..., can get its help information via stat--help or man stat

feature options: feature options need to be used in conjunction with the-c parameter, such as retrieving inode information for a file using stat, the inode number of the/filepath/filename file can be obtained with stat–c%i/filepath/filename.

For file systems:

Note: Using the-f option when the target file is the file system, such as retrieving the inode number of the file system with stat, uses Stat–f–c%c/filepath/filename to obtain the inode number of the/filepath/filename file system.

%a Free blocks available to Non-superuser Show remaining block information for non-superuser
%b Total data blocks in file system Total number of data blocks on file system
%c Total file nodes in file system Total Inode in File system
%d Free file nodes in file system Number of inode remaining in file system
%f Free blocks in file system Remaining blocks in the file system
%c SELinux Security Context String SELinux Security Content Information
%i File System ID in hex Hexadecimal file System ID
%l Maximum Length of filenames Maximum length of file name
%n File Name File name
%s Block size (for faster transfers) Block size (for faster transfer (speed))
%s Fundamental block Size (for block counts) The smallest block size
%t Type in hex Hex File System Type
%T Type in human readable form Types of file systems that humans can read

For files:

%a Access Rights in octal Octal File access rights
%A Access rights in human readable form File access rights for human reading
%b Number of blocks allocated (see%B) Number of blocks allocated
%B The size in bytes of each block reported by%b Block size
%c SELinux Security Context String SELinux Security Content Information
%d Device number in decimal Decimal device number
%d Device number in hex Hex Device number
%f Raw Mode in hex Hexadecimal Display Raw mode
%F File type Get file type
%g Group ID of Owner The group ID of the file owner
%G Group Name of Owner Group name of the file owner
%h Number of hard links Number of hard connections to a file
%i Inode number Inode number of the file
%n File Name File name
%N Quoted file name with Dereference if symbolic links If it is a symbolic link, the mapping relationship is displayed
%o I/O block size I/O block size
%s Total size, in bytes Total File Size
%t Major device type in hex Hexadecimal primary Device type
%T Minor device type in hex Hexadecimal secondary device type
%u User ID of Owner User ID of the file owner
%u User Name of Owner User name of the file owner
%x Time of last access Last access time of the file (Human readable)
%x Time of last access as seconds since Epoch Last access time of file (Unix time)
%y Time of last modification Time the last content of the file changed (Human readable)
%Y Time of last modification as seconds since Epoch File Last content Change time (Unix time)
%z Time of last change The last change in the file (in addition to the content also includes the permission information) time (human readable)
%Z Time of last change as seconds since Epoch The last change in the file (except the content also includes the permission information) time (Unix time)

Note: The content changes of the symbolic link file do not affect Mtime and CTime, only the target file.

--end--

This article is from "Communication, My Favorites" blog, please make sure to keep this source http://dgd2010.blog.51cto.com/1539422/1629945

Use the Stat command to obtain detailed status information for Linux file systems and files

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.