git: a52d0d76fa3e - main - find: Document possible formats
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 26 Jul 2025 17:12:44 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=a52d0d76fa3e47d5d64b4620280f26979afe15fc
commit a52d0d76fa3e47d5d64b4620280f26979afe15fc
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-07-26 17:11:10 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-07-26 17:12:38 +0000
find: Document possible formats
Accidentlaly committed with XXX write this. So write which formats
-printf supports.
Sponsored by: Netflix
---
usr.bin/find/find.1 | 76 +++++++++++++++++++++++++++++++++++++++++++++++++--
usr.bin/find/printf.c | 6 ++++
2 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index 3012ae472015..e5ca81e69bdc 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd November 23, 2024
+.Dd July 26, 2025
.Dt FIND 1
.Os
.Sh NAME
@@ -1096,7 +1096,79 @@ as zero;
It is not yet implemented.
.It Format:
One or two characters, described below, which indicates the information to display.
-XXX need to write this.
+.Bl -tag -width Ds
+.It p
+Path to file
+.It f
+Filename without directories.
+.It h
+Path relative to the starting point, or '.' if that's empty for some reason.
+.It P
+Unimplemented -- File with command line arg.
+.It H
+Unimplemented -- Command line arg.
+.It g
+gid in human readable form.
+.It G
+gid as a number.
+.It h
+uid in human readable form.
+.It U
+uid as a number.
+.It m
+File permission mode in octal.
+.It M
+File mode in
+.Xr ls 1
+standard form.
+.It k
+File size in KiB (units of 1024 bytes).
+.It b
+File size in blocks (Always 512 byte units, even if underlying storage
+size differs).
+.It s
+Size in bytes of the file.
+.It S
+Sparseness of the file.
+The blocks the file occupies times 512 divided by the file size.
+.It d
+Depth in the tree
+.It D
+Device number for the file.
+.It F
+Unimplemented -- Filesystem type where the file resides.
+.It l
+Object of the symbolic link.
+.It i
+Inode of the file.
+.It n
+Number of hard links.
+.It y
+Unimplemented -- Type of the file
+.It Y
+Unimplemented -- Type of the file with loop detection
+.It a
+Access time of the file.
+.It A
+Access time of the file in strftime format.
+Takes an additional argument.
+.It b
+Birth time of a file.
+.It B
+Birth time of the file in strftime format.
+Takes an additional argument.
+.It c
+Creation time of the file.
+.It C
+Creation time of the file in strftime format.
+Takes an additional argument.
+.It t
+Modification time of the file.
+.It T
+Modification time of the file in strftime format.
+Takes an additional argument.
+.El
+Any format not listed is not supported, though the error changes.
.El
.El
.Sh ENVIRONMENT
diff --git a/usr.bin/find/printf.c b/usr.bin/find/printf.c
index 671d1d1dbb9a..532c17bfb80b 100644
--- a/usr.bin/find/printf.c
+++ b/usr.bin/find/printf.c
@@ -269,6 +269,12 @@ do_printf(PLAN *plan, FTSENT *entry, FILE *fout)
case 'A': /* access time with next char strftime format */
fp_strftime(fp, sb->st_atime, *fmt++);
break;
+ case 'b': /* birth time */
+#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
+ fp_ctime(fp, sb->st_birthtime);
+#else
+ fp_ctime(fp, 0);
+#endif
case 'B': /* birth time with next char strftime format */
#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
if (sb->st_birthtime != 0)