diff options
author | brian <brian@FreeBSD.org> | 2007-04-27 18:23:32 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2007-04-27 18:23:32 +0000 |
commit | ad4f22d823820394750e39308b7feeecb33b34dd (patch) | |
tree | a42ad6dc0d613d19abd75b861617177f0b3aea3d /usr.bin | |
parent | d78d6e93585b48e0cff21dcfffc61b0a4c4ff021 (diff) | |
download | FreeBSD-src-ad4f22d823820394750e39308b7feeecb33b34dd.zip FreeBSD-src-ad4f22d823820394750e39308b7feeecb33b34dd.tar.gz |
Add some more examples. It always takes me a long time to find the S
modifier (-t is ignored without it).
MFC after: 1 week
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/stat/stat.1 | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/usr.bin/stat/stat.1 b/usr.bin/stat/stat.1 index d7ebb01..8c260e2 100644 --- a/usr.bin/stat/stat.1 +++ b/usr.bin/stat/stat.1 @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 8, 2003 +.Dd April 27, 2007 .Dt STAT 1 .Os .Sh NAME @@ -455,7 +455,7 @@ $ echo $st_size $st_mtimespec 1148 1015432481 .Ed .Pp -In order to get a list of the kind of files including files pointed to if the +In order to get a list of file types including files pointed to if the file is a symbolic link, you could use the following format: .Bd -literal -offset indent $ stat -f "%N: %HT%SY" /tmp/* @@ -497,6 +497,31 @@ Apr 25 11:47:00 2002 /tmp/blah Apr 25 10:36:34 2002 /tmp/bar Apr 24 16:47:35 2002 /tmp/foo .Ed +.Pp +To display a file's modification time: +.Bd -literal -offset indent +\*[Gt] stat -f %m /tmp/foo +1177697733 +.Ed +.Pp +To display the same modification time in a readable format: +.Bd -literal -offset indent +\*[Gt] stat -f %Sm /tmp/foo +Apr 27 11:15:33 2007 +.Ed +.Pp +To display the same modification time in a readable and sortable format: +.Bd -literal -offset indent +\*[Gt] stat -f %Sm -t %Y%m%d%H%M%S /tmp/foo +20070427111533 +.Ed +.Pp +To display the same in UTC: +.Bd -literal -offset indent +\*[Gt] sh +$ TZ= stat -f %Sm -t %Y%m%d%H%M%S /tmp/foo +20070427181533 +.Ed .Sh SEE ALSO .Xr file 1 , .Xr ls 1 , |