Home | History | Annotate | Download | only in stat
History log of /src/usr.bin/stat/stat.1
RevisionDateAuthorComments
 1.48  03-May-2025  kre PR bin/47333

Note that -L will fall back to use lstat() if the stat() requested
returns ENOENT (if the following lstat() fails, the ENOENT from
the lstat() is returned - that generally indicates that the original
ENOENT came from the filename passed to stat() rather than the
value of the symlink. (The man page doesn't say all of that.)

If "stat -L name" returns data from a symlink (eg: if -f %T is @)
then name must refer to a symlink which points to nothing.
(The man page does say that.)
 1.47  29-Jan-2024  christos branches: 1.47.2;
PR/57891: Ricardo Branco: add symbolic flags printing (from FreeBSD)
 1.46  24-Jun-2022  kre Remove the notge (I added a day or so ago) about IFS interfering with -s
output (potentially) - it is almost certainly wrong.
 1.45  23-Jun-2022  uwe stat(1): Fix two more -width.
 1.44  22-Jun-2022  uwe stat(1): Misc fixes.
 1.43  22-Jun-2022  wiz Use \(em, fix macro usage
 1.42  22-Jun-2022  kre Some corrections to stat to make it more reasonable, and comply with
the man page, in particular, in one of the EXAMPLES it is claimed:

This example produces output very similar to that from find ... -ls
(except that find(1) displays the time in a different format, and find(1)
sometimes adds one or more spaces after the comma in “major,minor” for
device nodes):

and then uses %9Z in the format, but conveniently does not use a
device file to demonstrate.

If it had, the result would have been:

8033 0 brw-r----- 1 root operator 4, 51 Jun 8 02:44:45 2022 /dev/sd3

Note the spaces which were claimed to exist (sometimes) in find(1) output
but not with stat. Oops.

Omitting those spaces seems like a good idea, so does using the same
field width for the result in both cases, rather than producing 9 chars
in the ordinary file case, and 19 (2 * 9 + 1) in the device case (for %9Z).

Now we will get:

8033 0 brw-r----- 1 root operator 4,51 Jun 8 02:44:45 2022 /dev/sd3

While here, also make the file number (%@) when reading stdin be 0, it is
not the 1st file in the arg list.

Some (very minor) KNF applied at the same time.

In stat.1 make these changes explicit.
 1.41  22-Jun-2022  kre Divide stat.1 into stat.1 (now only includes stat(1)) and readlink.1

Apologies to cvs commit purists, but making this division required
line by line reading of the man pages, and I simply could not resist
also correcting some errors, addressing some omissions, improving some
wording ... all at the same time.
 1.40  20-Sep-2017  wiz whitespace fixes, use Xr.
 1.39  19-Sep-2017  christos - if st_dev/st_rdev == NODEV print -1 instead of unsigned
- update to the latest linux stat(1) format for -x (kind of)
- add the ability to display nanoseconds, like linux does
- change u_intX_t -> uintX_t
 1.38  03-Jul-2017  wiz Remove workaround for ancient HTML generation code.
 1.37  13-Apr-2014  snj Change some standard exit status text to ".Ex -std"
From Eitan Adler in PR bin/47790.
 1.36  03-Dec-2012  wiz branches: 1.36.6;
Bump date for previous. Remove trailing whitespace.
 1.35  02-Dec-2012  erh Honor the -t option to set the time format when running stat -s.
Document the format used by -s on the man page.
 1.34  22-Sep-2011  apb branches: 1.34.2; 1.34.8;
Use vis(3) encoding when a string format is modified by the '#' flag.
Also bump copyright years.
 1.33  16-Sep-2011  apb More corrections to format compatibility between stat(1), find(1) -ls,
and ls(1) -lT.
 1.32  16-Sep-2011  wiz Remove unnecessary Ns.
 1.31  16-Sep-2011  apb Anothe difference in output format: stat -f "%Z" does not add any
space in "major,minor" for device nodes, whereas both "ls -l" and
"find -ls" add at least one space.
 1.30  15-Sep-2011  apb Add examples of formats for stat(1) to simulate "find -ls" and "ls -lTd".
 1.29  16-Feb-2011  christos Add verbose mode for readlink.
 1.28  05-Apr-2010  joerg branches: 1.28.2;
\\ -> \e
 1.27  11-Mar-2010  enami Since we have st_birthtime in struct stat, it is in default display.
 1.26  07-Nov-2008  wiz Drop trailing space.
 1.25  07-Nov-2008  reed Be consistent: document the birthtime field of struct stat for
the "B" field specifier.
 1.24  20-Oct-2008  wiz branches: 1.24.2;
Fix three variable names.
From Todd T. Fries via Jason McIntyre.
 1.23  30-Apr-2008  martin Convert TNF licenses to new 2 clause variant
 1.22  10-Nov-2007  atatat branches: 1.22.6;
Put back the NetBSD tag
 1.21  07-Nov-2007  wiz Document the flags displayed by the default format, and mention their short
names. From espie@openbsd via jmc@openbsd.
 1.20  07-Nov-2007  wiz Make sentence easier to parse. From jsing@openbsd via jmc@openbsd.
 1.19  07-Oct-2006  elad branches: 1.19.8;
PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't
grok -f, and there's no alternative (+fix)

Patch applied with minor tweak (%y -> %R, as it was already taken) plus
some nits from myself. Thanks!
 1.18  26-Jun-2005  wiz Sort SEE ALSO. Drop trailing space.
 1.17  23-Jun-2005  atatat Bend the 'L', 'M', and 'H' modifiers to work on the size, whereby it
is rounded to the nearest kilobyte, megabyte, or gigabyte.
Implemented at lukem's request since some things can't deal with
overly large numbers when files are really large.

Have to do something like humanize_number(3), but that interface isn't
really what I'm looking for. I think. More examination required.
 1.16  04-Apr-2005  wiz Some fixes from jmc@openbsd.
 1.15  08-Jan-2005  yamt correct examples.
 1.14  31-Dec-2004  atatat Add "dirname"- and "basename"-like functionality to stat(1) by way of
the "high" and "low" selectors on the filename.
 1.13  01-Sep-2004  wiz Sort options. Use more mdoc macros. Some nit fixes. Bump date.
 1.12  01-Sep-2004  yamt document default format.
 1.11  08-May-2003  wiz Bump date for last.
 1.10  08-May-2003  atatat Add %B to print the st_birthtime of an inode (adjusting the "raw"
format and "shell" format appropriately), and rename the st_*timespec
fields in the shell-style output to be st_*time, since that's what
they really are.
 1.9  21-Feb-2003  atatat Fix the sample output in one of the examples
 1.8  14-Feb-2003  grant The correct capitalisation of 'NetBSD.org' is (you
guessed it) 'NetBSD.org'.

some mdoc fixes.
 1.7  30-Sep-2002  grant New sentence, new line.
 1.6  13-Aug-2002  atatat Style sync with FreeBSD. Changes via Doug Barton <DougB@FreeBSD.org>.
 1.5  08-Jul-2002  atatat A new command line option, -q, suppresses *stat(2) failure messages.
Output is now done via stdio, instead of with my stupid homegrown
buffering (I don't even know why I did it that way in the first
place). Also, from Johan Karlsson <johan@freebsd.org>, eliminate a
spurious newline if no output was generated, and link stat(1) to
readlink(1) for similarity to OpenBSD.
 1.4  09-May-2002  atatat Add a simple format that translates to the current file number, fix an
off by one error, and #define a bunch more things to make it clearer.
 1.3  28-Apr-2002  wiz Formatting, grammar, spelling, and other improvements.
 1.2  28-Apr-2002  atatat That should be "ls -lTd", not "ls -lT"
 1.1  27-Apr-2002  atatat Add a stat(1) program to /usr/bin. It provides a simple formatting
interface, with reasonable defaults, to the information provided by
stat(2) so that scripts can use the data therein much more easily.
 1.19.8.1  09-Jan-2008  matt sync with HEAD
 1.22.6.1  18-May-2008  yamt sync with head.
 1.24.2.1  09-Nov-2008  snj Pull up following revision(s) (requested by reed in ticket #34):
usr.bin/stat/stat.1: revision 1.25
Be consistent: document the birthtime field of struct stat for
the "B" field specifier.
 1.28.2.1  17-Feb-2011  bouyer Sync with HEAD
 1.34.8.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.8.1  25-Feb-2013  tls resync with head
 1.34.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.2.1  16-Jan-2013  yamt sync with (a bit old) head
 1.36.6.1  10-Aug-2014  tls Rebase.
 1.47.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed