Home / Hệ điều hành / Linux / How to check size of a directory via Terminal in MacOS

How to check size of a directory via Terminal in MacOS

Print Friendly, PDF & Email

Sometimes we want to have a quick check the size of a specific directory in your current place from the terminal where you are working. Instead of opening Finder application – a common and unique file explorer on Mac, this need can be done by running the following command

du -sh <directory>

You can learn this command by running man du to see the other options as well as other usages. To remember this command, actually, du is short for “display disk usage statistics”.

The output of du -sh ./* command

If we don’t indicate a directory and -sh, the command will display the size of all directories recursively which are including all children directories. The size shows in bytes.

The output of du command

Hopefully, these tricks would bring a convenient way for you to check a directory’s size.

All constructive comments are welcomed. If you are willing to contribute financial support for our website, please follow the instructions below.

About Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via nguyenvungoctung@gmail.com if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

code

This site uses Akismet to reduce spam. Learn how your comment data is processed.