source: trunk/minix/man/man1/stat.1@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 2.2 KB
RevLine 
[9]1.TH STAT 1
2.SH NAME
3stat, lstat, readlink \- provide a shell interface to the stat(2) system call
4.SH SYNOPSIS
5.B stat
6.RB [ - ]
7.RB [ -\fIfd ]
8.RB [ -all ]
9.RB [ -s ]
10.RB [ -\fIfield " ...]"
11.RI [ file1 " ...]"
12.SH DESCRIPTION
13.B Stat
14does little more than provide access to the fields in the
15.B struct stat
16as defined in the
17.BR stat (2)
18manual page. Each field that is to be listed
19is specified as the field name without the leading
20.BR st_ .
21This and the other two options are described below. All options are then
22applied to the files listed. If
23.B stat
24is called as
25.B lstat
26then the
27.BR lstat (2)
28system call is used, if called as
29.B stat
30symbolic links are expanded with
31.BR stat (2).
32If called as
33.B readlink
34then the output is only the contents of the symbolic link.
35.PP
36If no fields are named then all fields are printed. If no files are listed
37then all open filedescriptors are printed.
38.SH OPTIONS
39.TP
40.B \-
41If the first argument is ``\-'', the list of files is assumed to come from stdin.
42This is useful for things like ``ls | stat \-uid \-mtime.''
43.B \-\fIfd
44If an argument is a ``\-'' followed by a number then that number is used as
45a file descriptor whose information is to be printed.
46.TP
47.B \-all
48List all fields for each file.
49.TP
50.B \-s
51Use
52.BR lstat (2).
53.TP
54.B \-mode
55List the
56.B mode
57field. Similarly for
58.BR ino ,
59.BR dev ,
60.BR rdev ,
61.BR nlink ,
62.BR uid ,
63.BR gid ,
64.BR size ,
65.BR atime ,
66.BR mtime ,
67and
68.BR ctime .
69Under BSD derived systems you also have
70.B blksize
71and
72.BR blocks .
73.PP
74.B \-Atime
75.br
76.B \-Mtime
77.br
78.B \-Ctime
79.RS
80The lower case versions of these three options display the time as an integer
81that is the ``seconds since 00:00 Jan 1. 1970.''
82Listing the fields with the first letter
83in caps causes the times to be printed in
84.BR ctime (3)
85format (i.e., human readable).
86.RE
87.SH EXAMPLES
88.LP
89# Find out the number of links to each file
90.br
91$ stat \-nlink *.c
92.LP
93# sort files by age (much like ls \-t)
94.br
95$ stat \-atime * | sort +1
96.LP
97# Find out which file is older in sh(1)
98.br
99if test `stat -mtime $1` -lt `stat -mtime $2`; then
100.br
101 echo $1 is older than $2
102.br
103else
104.br
105 echo $2 is older than $1
106.br
107fi
108.SH "SEE ALSO"
109.BR stat (2).
110.SH AUTHOR
111Larry McVoy (mcvoy@rsch.wisc.edu)
Note: See TracBrowser for help on using the repository browser.