Below are the ways to find the size of a directory and a file using Terminal app on a Mac.
Steps to Know Directory Size on Mac
- Open Terminal app using Spotlight Search.
Move to the directory that you want to know the size of.Example:
You will see the size of the directory displayed in KB/MB/GB.
Now run the command du with the flags "-sh"Example:
Know the size of a file
- Open Terminal App.
- Now move to the directory where the file is located.
Run the command ls with flags -lh followed by the filename.Example:
% ls -lh get.py -rwx------@ 1 dev staff 959B Aug 1 14:26 get.py
Facing issues? Have Questions? Post them here! I am happy to answer!
- How to Display Analog Clock on Mac Menu Bar
- Shutdown Mac Terminal Command
- How to know the Serial Number of MacBook on macOS Ventura 13.0
- macOS: Remove Desktop or Documents Folder from iCloud Drive Syncing
- [fix] How to Show file extensions on all files on Mac
- How to install Zoom Add-in to Outlook (Mac)
- How to turn off Stage Manager - macOS Ventura
- Fix - Xode - Internal logic error: Connection was invalidated
- How to do calculations in Mac Terminal
- How to delete a Page in Microsoft Word File on Mac (macOS)
- How to Refresh Mac Desktop
- How to install Java on macOS [Big Sur]
- How to Disable Mac Terminal Bell Sound
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to Uninstall Brew on Mac
- Find your macOS version
- Change TextEdit File Encoding
- AppleScript Example with TextEdit
- How to install homebrew (brew) on M1 Mac
- How to Find File and Directory Size in Mac Terminal
- How to open new tab in Sublime Text Editor [macOS]
- How to list all users in Mac Terminal
- Turn off Auto-Capitalization on macOS Ventura 13
- How to check Command Line Tools Version [Updated for Ventura]
- Change Current User Password using Mac Terminal Command
- How to run bash command in background - Bash
- [Fix] Cannot resolve No versions available for org.osgi.service:org.osgi.service.prefs:jar:[1.1.0,1.2.0) within specified range - Java
- Building library Gradle Project Info: Downloading services.gradle.org - Android-Studio
- 🔥 [BTS ARMY] #ExaBLINK, #ExaARMY hashtags trending worldwide - BTS
- Trigger Notification Center Message using Mac Terminal Command - MacOS
- Python: If Else Statements in One Single Line - Python
- Android: programmatically turn Bluetooth on or off using Java code - Android
- How to find lost AirPods? - HowTos