3 stat, lstat, readlink \- provide a shell interface to the stat(2) system call
10 .RB [ -\fIfield " ...]"
14 does little more than provide access to the fields in the
18 manual page. Each field that is to be listed
19 is specified as the field name without the leading
21 This and the other two options are described below. All options are then
22 applied to the files listed. If
28 system call is used, if called as
30 symbolic links are expanded with
34 then the output is only the contents of the symbolic link.
36 If no fields are named then all fields are printed. If no files are listed
37 then all open filedescriptors are printed.
41 If the first argument is ``\-'', the list of files is assumed to come from stdin.
42 This is useful for things like ``ls | stat \-uid \-mtime.''
44 If an argument is a ``\-'' followed by a number then that number is used as
45 a file descriptor whose information is to be printed.
48 List all fields for each file.
69 Under BSD derived systems you also have
80 The lower case versions of these three options display the time as an integer
81 that is the ``seconds since 00:00 Jan 1. 1970.''
82 Listing the fields with the first letter
83 in caps causes the times to be printed in
85 format (i.e., human readable).
89 # Find out the number of links to each file
93 # sort files by age (much like ls \-t)
95 $ stat \-atime * | sort +1
97 # Find out which file is older in sh(1)
99 if test `stat -mtime $1` -lt `stat -mtime $2`; then
101 echo $1 is older than $2
105 echo $2 is older than $1
111 Larry McVoy (mcvoy@rsch.wisc.edu)