find /tmp -printf '%s %p\n' |sort -n -r | head
This command is working fine but what are the %s %p
options used here? Are there any other options that can be used?
find /tmp -printf '%s %p\n' |sort -n -r | head
This command is working fine but what are the %s %p
options used here? Are there any other options that can be used?
What are the %s %p options used here?
From the man page:
%s File's size in bytes.
%p File's name.
Scroll down on that page beyond all the regular letters for printf and read the parts which come prefixed with a %.
%n Number of hard links to file.
%p File's name.
%P File's name with the name of the starting-point under which it was found removed.
%s File's size in bytes.
%t File's last modification time in the format returned by the C `ctime' function.
Are there any other options that can be used?
There are. See the link to the manpage.
man find|wc -c
results about 78 kByte, this is why your answer is useful.
– peterh
Jan 26 '21 at 14:56
-printf "%TY-%Tm-%TdT%TT %p\n"
(including the double quotes) prefixes the file name with the modification time in ISO 8601 format. (On some systems, the seconds part is in nanosecond resolution which may ruin the display - a post filter, likeperl -nle 's/(\d\dT[^\.]+\.\d\d\d)\d+/$1/g; print $_'
, may be required). – Peter Mortensen Jan 18 '22 at 18:46