ls
To display a human-readable file size in long format using ls
:
$ ls -lh <file>
To display the size of files in a directory:
$ ls -lh <directory>
sort
To sort by size in descending order:
$ ls -lhS <directory>
To sort by size in ascending order:
$ ls -lhrS <directory>
du
To get the size of a directory, use the du
command:
$ du -sh <directory>