Here are some tips to measure the size of a file, size of a directory and size of everything in your machine using command line in Linux/Mac OS X.
How to Find the Size of a File in Linux/ Mac OS X?
There are a number of ways to find the file size using Linux commands on the terminal. Here is a command that is useful in many ways. One can use the command “du” to do a number of cool things including finding the file size. “du” is disc usage utility command in Linux/ Mac OS X.
>>du -h pathToFile
The option “h” gives the file size in a human readable format, for example, in Kilobyte, Megabyte, and Gigabyte.
How to Find the Size of a Directory in Linux/ Mac OS X?
To get the size of a directory or a folder, use “du” with the option “hs” as follows.
>>du -hs pathToDirectory
The option “s” summarizes the result and give the size of directory in a single line. In the absence of the option “s”, the command will list all files and their sizes in the directory.
How to Find the Free Disk Space In Your Linux/ Mac OS X Computer
The easiest way to find your disk space is to the utility command “df”.
>>df -h
The “df” command with “h” option will list all the file systems in your machine and give the total, used, and available sizes of disk space in a user friendly way.
Related posts:
aha, thanks for the tips.
Here I add some more apple ipad, iphone, ipod and MAC OS tips, turn to this apple spot:
http://www.ifunia.com/resources.html