Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/stat Add examples of formats for stat(1) to simulate...



details:   https://anonhg.NetBSD.org/src/rev/5013cb42b09f
branches:  trunk
changeset: 769609:5013cb42b09f
user:      apb <apb%NetBSD.org@localhost>
date:      Thu Sep 15 19:56:35 2011 +0000

description:
Add examples of formats for stat(1) to simulate "find -ls" and "ls -lTd".

diffstat:

 usr.bin/stat/stat.1 |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r e8c45751d2d8 -r 5013cb42b09f usr.bin/stat/stat.1
--- a/usr.bin/stat/stat.1       Thu Sep 15 19:32:28 2011 +0000
+++ b/usr.bin/stat/stat.1       Thu Sep 15 19:56:35 2011 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: stat.1,v 1.29 2011/02/16 23:08:29 christos Exp $
+.\"    $NetBSD: stat.1,v 1.30 2011/09/15 19:56:35 apb Exp $
 .\"
 .\" Copyright (c) 2002-2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 16, 2011
+.Dd September 15, 2011
 .Dt STAT 1
 .Os
 .Sh NAME
@@ -473,6 +473,32 @@
 0 78852 -rw-r--r-- 1 root wheel 0 0 "Jul  8 10:26:03 2004" "Jul  8 10:26:03 2004" "Jul  8 10:28:13 2004" "Jan  1 09:00:00 1970" 16384 0 0 /tmp/bar
 .Ed
 .Pp
+This example produces output very similar to that from
+.Ic find ... -ls
+(except that
+.Xr find 1
+displays the time in a different format):
+.Bd -literal -offset indent
+\*[Gt] stat -f "%7i %6b %-11Sp %3l %-17Su %-17Sg %9Z %Sm %N%SY" /tmp/bar
+  78852      0 -rw-r--r--    1 root              wheel                     0 Jul  8 10:26:03 2004 /tmp/bar
+
+\*[Gt] find /tmp/bar -ls -exit
+  78852      0 -rw-r--r--    1 root              wheel                     0 Jul  8  2004 /tmp/bar
+.Ed
+.Pp
+This example produces output very similar to that from
+.Ic ls -lTd
+(except that
+.Xr ls 1
+adjusts the column spacing differently when listing multiple files):
+.Bd -literal -offset indent
+\*[Gt] stat -f "%-11Sp %l %Su  %Sg  %5Z %Sm %N%SY" /tmp/bar
+-rw-r--r--  1 root  wheel  0 Jul  8 10:26:03 2004 /tmp/bar
+
+\*[Gt] ls -lTd /tmp/bar
+-rw-r--r--  1 root  wheel  0 Jul  8 10:26:03 2004 /tmp/bar
+.Ed
+.Pp
 Given a symbolic link
 .Dq foo
 that points from



Home | Main Index | Thread Index | Old Index