May 8

the -k parameter lets you sort based on a key field instead of the first string. To use it to sort a batch of strings that look like this
-rw-rw-r-- 1 user prod 2406912 May 7 05:00 ./backups/daily/BaseClassAO-050708.tar
-rw-rw-r-- 1 user prod 1703424 May 7 05:00 ./backups/daily/BaseClassP-050708.tar

by the file size, use sort like so

sort -n -k5

telling sort to use the 5th field (as delimited by the space character) to sort on.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.