Sort file paths by metadata.
go install github.com/CatsDeservePets/fsort@latestusage: fsort [-f] [-z] [-C dir] [-k key | -K key] ... [file ...]
-C dir
change to dir before resolving input names
-K key
same as -k, but sorts by key in descending order
-f fold lowercase characters to uppercase before comparison
-k key
sort by key in ascending order. Key must be one of name,
path, extension, type, perm, size, or time. The -k and -K
options may be specified multiple times; subsequent keys
are compared when earlier keys compare equal. By default,
fsort sorts by name.
-z line delimiter is NUL, not newline
Find the most recently modified log files:
find /var/log -type f -name '*.log' | fsort -K timeFind the largest archives in a directory tree:
find . -type f \( -name '*.zip' -o -name '*.tar.gz' -o -name '*.iso' \) | fsort -K sizeSort images by type, then by name:
fsort -k extension -k name *.jpg *.png *.gif *.webp