Manual page
Misc. Reference Manual Pages STAT(1L)
NAME
stat - display file info
SYNOPSIS
stat [ -VnNMprwxtugoiUGszamcAlL ] [ -f arg ] files
DESCRIPTION
Stat prints out file information about selected files.
Without any option stat print out as much information it
can. Switches can be used to limit the displayed informa
tion. If switches are used, information is gathered on one
line only and displayed in the same order as the switches.
This makes it possible to use constructions as "stat -ins *
| sort -n" to display all files with their sizes and inode
numbers, sorted in inode order. Any number of options may
be used in any order.
OPTIONS
-V Version: display stat version number.
-n Name: display the filename.
-N Name: display the filename expanded to a full path.
-M mode: show file mode in octal.
-p mode: show file protection in octal.
-r Read: show those who have read access to the file.
-w Write: show those who have write access to the file.
-x eXecute: show those who have execute access to the
file.
-t Type: show the one character file type code.
-u User: show the access rights for the user.
-g Group: show the access rights for the group.
-o Other: show the access rights for the other users.
-i Inode: show the inode number of the file.
-U UID: show the UID of the owner.
-G GID: show the GID of the owner.
-s Size: show the file size.
-z Allocated size: show the allocated size.
SunOS 5.8 Last change: 1
Misc. Reference Manual Pages STAT(1L)
-a Access: show the last access date/time.
-m Modify: show the last modification date/time.
-c Change: show the last status change date/time.
-A link Arrow: show " -> " if the file is a symbolic link.
-l Link: target of symbolic link.
-L Link: target of symbolic link expanded to a full path.
-farg or -f arg
Format: printf-like formatting. Arg is a quoted string
containing ordinary text and formatting commands as
described below.
FORMATS
Formatting commands begin with either % or \. %-prefixes
directs insertion of file information.
The format is %[+<type>][<number><format>]<command>, where
<command> is one of the option characters described above.
The optional +<type> field determines output type. The type
is specific for each <command>.
Time related formatting commands a, m, and c, have the fol
lowing output types.
+i Output format as specified by ISO 8601.
+c Output format as specified by ctime(3).
+s Output format is number of seconds since 1970-01-01
(POSIX).
User and group related formatting commands U and G have the
following output types.
+t Output format is text.
+n Output format is numeric.
The optional <number><format> fields determines output for
mat, <number> is the output field width. and <format> deter
mines left justify, right justify, or center. The range for
<number> is 1 to 1024, and <format> can be l, r, or c. Exam
ples: %15ln (filename left justified in 15 character field),
%7rs and %20cn.
SunOS 5.8 Last change: 2
Misc. Reference Manual Pages STAT(1L)
The \-prefix inserts special characters. \t is tab, \n is a
newline, \\ is the \-character, and \% is %.
EXAMPLES
stat file
stat *.c
stat -N *
stat -ins * | sort -n | cut -f2,3 -d" "
stat -f ´File: %n\tSize: %s\n´ *.c
stat -f ´%16ln%6rs\n´ *
stat -f ´%+s12rm %n\n´ *
stat -f ´%12r+sm %n\n´ * same as previous
stat -f ´%+im %n\n´ *
stat -f ´%t%u%g%o %n\n´ *
stat -f ´%t%u%g%o %n%A%L\n´ *
stat -f ´%16rn is ´ -N -s -rw *.c
stat -f ´%16rn is %N %s %r %w\n´ *.c same as previous
BUGS
The sum of the lengths of the arguments to all -f options
plus the number of other options times three must not exceed
8192 characters. No checks are done to ensure this. The
width of a formatted field must not exceed 1024 characters.
SEE ALSO
stat(2) stat(5)
DIAGNOSTICS
"stat: illegal option -- <<option>>", the option is not
known.
"stat: option requires an argument -- <<option>>", the -f
option requires an argument.
"stat: cannot stat <<file>>" when a file does not exist.
"stat: unknown output type: <<type>>" when an unknown type
has been given.
During formatted output, bad format commands, <commands>,
are just passed through without warning. Bad formatting
widths, <number>, and bad formatting formats, <format>, are
replaced by **FTL** and **BFJ** respectively. Items that are
too big for the given width, are truncated on the free side
SunOS 5.8 Last change: 3
Misc. Reference Manual Pages STAT(1L)
(left for right justify, right for left justify, and both
sides for center) and an ! is insterted at the truncated
end.
AUTHOR
Göran Larsson <http://www.mitt-eget.com>
SunOS 5.8 Last change: 4
Links
The page has been visited
times since 2002-10-30.
Last modified 2003-09-14 18:22:19 (built 2008-02-04 23:18:36).
Copyright © 2002-2006 Göran Larsson. All rights reserved.