This post is about the linux commands df and du and will show you how to get information about available diskspace and determine the accumulated size of a directory/folder using terminal on Linux/OS X.
Available disk space
Be aware that there are a few difference in df on OS X and linux.
To get current information about disk usage and availability, you can use this command in terminal:
If you want the information to be displayed in MB, use this command on OS X:
On Linux you would use:
Size of directory/folder
To get the accumulated size of a directory/folder, you can use this command in terminal:
du -hs /directory/to/get/size/of
And to get the information for multiple file/folders/directories in one go, you can use this command:
du -hs /directory/to/get/sizes/of/files/in/*