How can I sort all files by size in a directory?

Solution 1:

ls(1) /sort:

-S     sort by file size

Solution 2:

$ 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