How to Use the ls Command to List Files and Directories on Linux
Dec 03, 2019 · To sort by extension, use the -X (sort by extension) option. ls -X -1. The directories are listed first (no extensions at all) then the rest follow in alphabetical order, according to the extensions. To sort by file size, use the -S (sort by file size) option. ls -l -h -S. The sort order is largest to smallest.
DA: 63 PA: 97 MOZ Rank: 2