Check Disk Space in Mac Terminal
Checking disk space in the Mac Terminal is a quick and efficient way to monitor your storage usage without relying on the graphical interface.
By using commands like df and du, you can get detailed information about your disk usage, available space, and where your storage is being consumed.
In this guide, we will walk you through the steps to check disk space using df and du commands in the Mac Terminal.
Using the df Command to Check Disk Space
The df command (disk free) is a built-in tool that shows you an overview of the available and used space on all mounted filesystems. To check your disk space usage, simply open the Terminal and enter the following command:
df -h
The -h flag stands for “human-readable” and displays the sizes in GB, MB, etc., making the output easier to understand. Here’s an example of the output:

Here’s what the columns mean:
- Filesystem: The name of the disk or partition.
- Size: The total size of the disk or partition.
- Used: The amount of space that has been used.
- Avail: The amount of space that is still available for use.
- Capacity: The percentage of space that has been used.
- Mounted on: The location where the filesystem is mounted (i.e., the directory where it is accessible).
Checking Disk Space for a Specific Directory with du
If you want to check how much space a specific directory is using, you can use the du command (disk usage). The du command provides a more detailed look at the space being used by files and directories. To see the total disk usage for a specific directory (e.g., your Documents folder), use the following command:
du -sh ~/Documents
In this command:
-sprovides a summary of the total disk usage for the directory.-hdisplays the output in a human-readable format (GB, MB, etc.).
The command will return a summary of the total size of the Documents folder. For example:

This indicates that the Documents folder is using 5.3 GB of space.
Finding the Largest Files and Folders
To identify the largest files and directories consuming your disk space, you can use the du command with additional options to display a sorted list of the largest items. For example, to find the largest files and directories in the /Users/yourusername directory, run the following command:
du -ah ~/ | sort -rh | head -n 10
Here’s what the options mean:
-adisplays the size of both files and directories.-hdisplays the output in human-readable format (GB, MB, etc.).sort -rhsorts the results by size, in descending order.head -n 10displays only the top 10 largest items.
This command will list the 10 largest files and directories in your home folder, helping you quickly identify where the most space is being used.
Checking Disk Space on an External Drive
If you have an external drive connected to your Mac and want to check its available space, you can use the df command and specify the drive’s mount point or device name. To find the device name of your external drive, use the following command:
df -h
Look for the entry that corresponds to your external drive (usually something like /Volumes/ExternalDrive), and note the mount point.

Then, run the df command with the mount point to check the disk space:
df -h /Volumes/ExternalDrive
This will show you the available and used space on the external drive.

