How to Display File Size in MB, KB, or GB in Ubuntu Linux
Jun 24, 2024Managing disk space on a Linux system can be a breeze with the right tools. One of the best commands for this task is `du -sh *`, which lists file sizes in a human-readable format.
What is `du -sh *`?
- du: Disk Usage command.
- -s: Summarize disk usage for each file/directory.
- -h: Output in human-readable format (e.g., K, M, G).
- *: Wildcard to match all files and directories.
Output example
$ du -sh *
4.0K file1.txt
16K file2.txt
1.5M project
200M videos