stat.1

来自「minix操作系统最新版本(3.1.1)的源代码」· 1 代码 · 共 107 行

1
107
字号
.TH STAT 1.SH NAMEstat, lstat \- provide a shell interface to the stat(2) system call.SH SYNOPSIS.B stat.RB [ - ].RB [ -\fIfd ].RB [ -all ].RB [ -s ].RB [ -\fIfield " ...]".RI [ file1 " ...]".SH DESCRIPTION.B Statdoes little more than provide access to the fields in the.B struct statas defined in the.BR stat (2)manual page.  Each field that is to be listedis specified as the field name without the leading.BR st_ .This and the other two options are described below.  All options are thenapplied to the files listed.  If.B statis called as.B lstatthen the.BR lstat (2)system call is used, otherwise symbolic links are expanded with.BR stat (2)..PPIf no fields are named then all fields are printed.  If no files are listedthen all open filedescriptors are printed..SH OPTIONS.TP .B \-If the first argument is ``\-'', the list of files is assumed to come from stdin.This is useful for things like ``ls | stat \-uid \-mtime.''.B \-\fIfdIf an argument is a ``\-'' followed by a number then that number is used asa file descriptor whose information is to be printed..TP .B \-allList all fields for each file..TP.B \-sUse.BR lstat (2)..TP.B \-modeList the.B modefield.  Similarly for.BR ino ,.BR dev ,.BR rdev ,.BR nlink ,.BR uid , .BR gid ,.BR size ,.BR atime ,.BR mtime ,and.BR ctime .Under BSD derived systems you also have .B blksizeand.BR blocks ..PP .B \-Atime.br.B \-Mtime.br.B \-Ctime.RSThe lower case versions of these three options display the time as an integerthat is the ``seconds since 00:00 Jan 1. 1970.''Listing the fields with the first letterin caps causes the times to be printed in.BR ctime (3)format (i.e., human readable)..RE.SH EXAMPLES.LP # Find out the number of links to each file.br$ stat \-nlink *.c.LP# sort files by age (much like ls \-t).br$ stat \-atime * | sort +1.LP# Find out which file is older in sh(1).brif test `stat -mtime $1` -lt `stat -mtime $2`; then.br	echo $1 is older than $2.brelse.br	echo $2 is older than $1.brfi.SH "SEE ALSO".BR stat (2)..SH AUTHORLarry McVoy (mcvoy@rsch.wisc.edu)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?