stat(1)


NAME
     stat, lstat - provide a shell interface to the stat(2) system call

SYNOPSIS
     stat [-all] [-size] [-mode ...] files ...

DESCRIPTION
     Stat does little more than provide access to the  fields  in  the  struct
     stat  as  defined  in  the stat(2) manual page.  Each field that is to be
     listed is specified as the field name without the leading st_.  This  and
     the  other two options are described below.  All options are then applied
     to the files listed.  If stat is called as lstat then the lstat(2) system
     call is used, otherwise symbolic links are expanded with stat(2).

OPTIONS

     -    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.''

     -all List all fields for each file.

     -s   Use lstat(2).

     -mode
          List the mode field.  Similarly for ino, dev, rdev, nlink, uid, gid,
          size,  atime,  mtime,  and  ctime.   Under BSD systems you also have
          blksize and blocks.

     -Atime
     -Mtime
     -Ctime
          The lower case versions of these three options display the  time  as
          an integer that is the ``seconds since 00:00 Jan 1. 1970.''  Listing
          the fields with the first letter in caps  causes  the  times  to  be
          printed in ctime(3) format (i.e., human readable).

EXAMPLES

     # Find out the number of links to each file
     $ stat -nlink *.c

     # sort files by age (much like ls -t)
     $ stat -atime * | sort +1

     # Find out which file is older in sh(1)
     if test `stat -mtime $1` -lt `stat -mtime $2`; then
             echo $1 is older than $2
     else
             echo $2 is older than $1

     fi

SEE ALSO
     stat(2).

AUTHOR
     Larry McVoy (mcvoy@rsch.wisc.edu)