Mac: See File Sizes in Terminal
Problem: I’ve got a terminal opened in a directory on my computer. I want to see a list of all the files in the directory along with their corresponding file sizes, in human-readable form. How can I do this?
Solution: To see the file sizes of all the files in a given directory, simply type:
du -h *
- du will list the memory consumption of the directory
- -h tells it to print out human-readable sizes, as in kilobytes, megabytes, gigabytes, etc.
- * Tells it you want to see all the individual items in the directory