How can I sort all files by size in a directory?
ls(1)
/sort
:
-S sort by file size
$ ls -lhS
-l use a long listing format
-h with -l, print sizes in human readable format (e.g., 1K 234M 2G)
-S sort by file size
If you have the appropriate sort
version you may simply use:
du -h | sort -rh
mine is
$ sort --version
sort (GNU coreutils) 8.12