Whamcloud - gitweb
LU-10378 utils: add formatted printf to lfs find
[fs/lustre-release.git] / lustre / doc / lfs-find.1
index 063f6d9..a021dcb 100644 (file)
@@ -5,40 +5,40 @@ lfs-find \- Lustre client utility to list files with specific attributes
 .B lfs find \fR<\fIdirectory\fR|\fIfilename \fR...>
       [[\fB!\fR] \fB--atime\fR|\fB-A\fR [\fB-+\fR]\fIn[smhdwy]\fR]
 [[\fB!\fR] \fB--blocks\fR|\fB-b\fR [\fB+-\fR]\fIn\fR]
-      [[\fB!\fR] \fB--btime\fR|\fB--Btime\fR|\fB-B\fR [\fB+-\fR]\fIn[smhdwy]\fR]
-      [[\fB!\fR] \fB--ctime\fR|\fB-C\fR [\fB+-\fR]\fIn[smhdwy]\fR]
+      [[\fB!\fR] \fB--btime\fR|\fB-B\fR [\fB+-\fR]\fIn[smhdwy]\fR]
+[[\fB!\fR] \fB--ctime\fR|\fB-C\fR [\fB+-\fR]\fIn[smhdwy]\fR]
       [[\fB!\fR] \fB--component-count|\fB--comp-count\fR [\fB+-\fR]\fIn\fR]
       [[\fB!\fR] \fB--component-end|\fB--comp-end\fR|\fB-E\fR [\fB+-\fR]\fIn\fR[\fBKMGTPE\fR]]
-      [[\fB!\fR] \fB--component-flags|\fB--comp-flags\fR <[^]\fIflag\fB,\fR...>]
+      [[\fB!\fR] \fB--component-flags|\fB--comp-flags\fR [^]\fIFLAG\fB,\fR...]
       [[\fB!\fR] \fB--component-start|\fB--comp-start\fR [\fB+-\fR]\fIn\fR[\fBKMGTPE\fR]]
       [[\fB!\fR] \fB--extension-size|\fB-z\fR [\fB+-\fR]\fIn\fR[\fBKMG\fR]]
-      [[\fB!\fR] \fB--gid\fR|\fB-g\fR|\fB--group\fR|\fB-G\fR <\fIgname\fR>|<\fIgid\fR>]
-      [[\fB!\fR] \fB--layout\fR|\fB-L mdt\fR,\fBraid0\fR,\fBreleased\fR]
-      [[\fB!\fR] \fB--foreign\fR [<\fItype\fR>]]
-[[\fB!\fR] \fB--gid\fR|\fB-g\fR|\fB--group\fR|\fB-G\fR <\fIgname\fR>|<\fIgid\fR>]
-      [[\fB!\fR] \fB--layout\fR|\fB-L mdt\fR,\fBraid0\fR,\fBreleased\fR]
+      [[\fB!\fR] \fB--foreign\fR [\fITYPE\fR]]
+[[\fB!\fR] \fB--gid\fR|\fB-g\fR|\fB--group\fR|\fB-G\fR \fIGNAME\fR|\fIGID\fR>]
+      [\fB--help\fR|\fB-h\fR]
+[[\fB!\fR] \fB--layout\fR|\fB-L mdt\fR,\fBraid0\fR,\fBreleased\fR]
 [\fB--lazy\fR]
       [\fB--maxdepth\fR|\fB-D\fI n\fR]
-[[\fB!\fR] \fB--mdt\fR|\fB--mdt-index\fR|\fB-m\fR <\fIuuid\fR|\fIindex\fR,...>]
+[[\fB!\fR] \fB--mdt\fR|\fB--mdt-index\fR|\fB-m\fR \fIUUID\fR|\fIINDEX\fR,...]
       [[\fB!\fR] \fB--mdt-count\fR|\fB-T\fR [\fB+-\fR]\fIn\fR]
-[[\fB!\fR] \fB--mdt-hash\fR|\fB-H <\fIhashtype\fR>]
+[[\fB!\fR] \fB--mdt-hash\fR|\fB-H \fR<[^]\fIHASHFLAG\fR,[^]\fIHASHTYPE\fR,...>]
       [[\fB!\fR] \fB--mirror-count|\fB-N\fR [\fB+-\fR]\fIn\fR]
-[[\fB!\fR] \fB--mirror-state\fR <[^]\fIstate\fR>]
+[[\fB!\fR] \fB--mirror-state\fR [^]\fISTATE\fR]
       [[\fB!\fR] \fB--mtime\fR|\fB-M\fR [\fB-+\fR]\fIn[smhdwy]\fR]
-[[\fB!\fR] \fB--name\fR|\fB-n <\fIpattern\fR>]
-      [[\fB!\fR] \fB--newer\fR[\fBXY\fR] <\fIreference\fR>]
-      [[\fB!\fR] \fB--ost\fR|\fB-O\fR <\fIindex\fR,...>]
-[[\fB!\fR] \fB--pool\fR <\fIpool\fR>]
+[[\fB!\fR] \fB--name\fR|\fB-n \fIPATTERN\fR]
+      [[\fB!\fR] \fB--newer\fR[\fBXY\fR] \fIREFERENCE\fR]
+      [[\fB!\fR] \fB--ost\fR|\fB-O\fR \fIINDEX\fR,...]
+      [[\fB!\fR] \fB--perm\fR [\fB/-\fR]\fIMODE\fR ]
+[[\fB!\fR] \fB--pool\fR \fIPOOL\fR]
 [\fB--print\fR|\fB-P\fR]
       [\fB--print0\fR|\fB-0\fR]
-[[\fB!\fR] \fB--projid\fR |<\fIprojid\fR>]
+[\fB--printf\fR \fIFORMAT\fR]
+[[\fB!\fR] \fB--projid\fR \fIPROJID\fR]
       [[\fB!\fR] \fB--size|\fB-s\fR [\fB-+\fR]\fIn\fR[\fBKMGTPE\fR]]
 [[\fB!\fR] \fB--stripe-count|\fB-c\fR [\fB+-\fR]\fIn\fR]
       [[\fB!\fR] \fB--stripe-index|\fB-i\fR \fIn\fR,...]
 [[\fB!\fR] \fB--stripe-size|\fB-S\fR [\fB+-\fR]\fIn\fR[\fBKMG\fR]]
       [[\fB!\fR] \fB--type\fR|\fB-t\fR {\fBbcdflps\fR}]
-[[\fB!\fR] \fB--uid\fR|\fB-u\fR|\fB--user\fR|\fB-U
-<\fIuname\fR>|<\fIuid>\fR]
+[[\fB!\fR] \fB--uid\fR|\fB-u\fR|\fB--user\fR|\fB-U  \fIUNAME\fR|\fIUID\fR]
 .SH DESCRIPTION
 .B lfs find
 is similar to the standard
@@ -119,7 +119,7 @@ File has a foreign (non-Lustre/free format) layout and is of the given
 if specified.  Presently only
 .B none
 or
-.B daos
+.B symlink
 are defined types, though 32-bit numeric types can also be used.
 .TP
 .BR --gid | -g
@@ -128,6 +128,9 @@ File has specified numeric group ID.
 .BR --group | -G
 File belongs to specified group, numeric group ID allowed.
 .TP
+.BR --help | -h
+Print usage message.
+.TP
 .BR --layout | -L
 File has a layout of the given type, one of:
 .RS 1.2i
@@ -167,9 +170,15 @@ Simple hash function that sums all of the characters in the filename.
 This is mostly for testing, or if it is known that filenames will use
 sequential filenames.
 .RE
+This implicitly selects only directories to be matched, like
+.B -type d
+and not other file types.
 .TP
 .BR --mdt-count | -T
-The DNE striped directory has the given number of MDT shards.
+The DNE striped directory has the given number of MDT shards.  This
+implicitly selects only directories to be matched, like
+.B -type d
+and not other file types.
 .TP
 .BR --mirror-count | -N
 The file has \fIn\fR mirrors in its layout.
@@ -256,6 +265,16 @@ filesystem only once when migrating objects off multiple OSTs for evacuation
 and replacement using
 .BR lfs-migrate (1).
 .TP
+.BR "--perm \fImode\fR"
+File's permission are exactly \fImode\fR (octal or symbolic).
+.TP
+.BR "--perm /\fImode\fR"
+All of the permission bits \fImode\fR are set for the file.
+.TP
+.BR "--perm -\fImode\fR"
+Any of the permission bits \fImode\fR are set for the file. If no permission
+bits in \fImode\fR are set, this test matches any file.
+.TP
 .BR --pool
 Layout was created with the specified
 .I pool
@@ -273,6 +292,105 @@ with the
 .B -0
 option to handle filenames with embedded spaces or other special characters.
 .TP
+.BR "--printf \fIformat\fR"
+Print \fIformat\fR to standard output for each matching file, interpreting
+`\' escapes and `%' directives.  Unlike \fB--print\fR, the \fB--printf\fR option
+does not automatically add a newline to the end of the string. The escapes and
+directives are:
+.RS 1.2i
+.TP
+.B \en
+Newline.
+.TP
+.B \et
+Horizontal tab.
+.TP
+.B \e\e
+A literal backslash.
+.TP
+.B %%
+A literal percent sign.
+.TP
+.B %a
+File\'s last access time in the format returned by the C \`ctime\' function.
+.TP
+.B %A@
+File\'s last access time in seconds since Jan. 1, 1970, 00:00 GMT.
+.TP
+.B %b
+The amount of disk space used for the file (in 512-byte blocks).
+.TP
+.B %c
+File\'s last status change time in the format returned by the C \`ctime\' function.
+.TP
+.B %C@
+File\'s last status change time in seconds since Jan. 1, 1970, 00:00 GMT.
+.TP
+.B %G
+File\'s numeric group ID.
+.TP
+.B %m
+File permission bits (in octal).
+.TP
+.B %p
+File's name.
+.TP
+.B %s
+File size in bytes.
+.TP
+.B %t
+File\'s last modification time in the format returned by the C \`ctime\' function.
+.TP
+.B %T@
+File\'s last modification time in seconds since Jan. 1, 1970, 00:00 GMT.
+.TP
+.B %U
+File's numeric user ID.
+.TP
+.B %w
+File\'s birth time in the format returned by the C \`ctime\' function.
+.TP
+.B %W@
+File\'s birth time in seconds since Jan. 1, 1970, 00:00 GMT.
+.TP
+.B %y
+File's type (f=file, d=directory, p=pipe, b=block device, c=character device,
+s=socket l=symbolic link)
+.TP
+Lustre-specific information about a file can be printed using these directives:
+.TP
+.B %Lc
+File\'s stripe count.  For a composite file, this is the stripe count of the last
+instantiated component.
+.TP
+.B %LF
+File Identifier (FID) associated with the file.
+.TP
+.B %Lh
+Directory's hash type (or \`none\' for an unstriped directory).
+.TP
+.B %Li
+File\'s starting OST index (or starting MDT index for a directory).
+For a composite file, this is the starting OST index of the last instantiated
+component.
+.TP
+.B %Lo
+List of all OST/MDT indices associated with a file or directory.
+.TP
+.B %Lp
+File\'s OST pool name.  For a composite file, this is the pool associated
+with the last instantiated component.  (NOTE: This can also be used for
+directories, but since MDT pools are not currently implemented, nothing will
+be printed.)
+.TP
+.B %LP
+Numeric project ID assigned to the file or directory.
+.TP
+.B %LS
+File's stripe size.  For a composite file, this is the stripe size of the last
+instantiated component.
+.RE
+.TP
 .BR --projid
 File has specified numeric project ID.
 .TP
@@ -365,9 +483,9 @@ Recursively list all mirrored files that have more than 2 mirrors.
 .B $ lfs find ! --mirror-state=ro /mnt/lustre
 Recursively list all out-of-sync mirrored files.
 .TP
-.B $ lfs find ! --foreign=daos /mnt/lustre
+.B $ lfs find ! --foreign=symlink /mnt/lustre
 Recursively list all but foreign files/dirs of
-.B daos
+.B symlink
 type.
 .SH BUGS
 The