How to find the Size of a folder in Unix

Its very easy to find the size of a folder in windows, where as it might be difficult to a novice user doing the same on Unix based systems. Its because the Unix file system does not show a folder size in a file listing using a short listing ls or long listing ls -l

The size of 4.0k or so shown before the folder name in a long listing is not an actual size of the folder. However we are blessed with many simple commands that makes our jobs simple. One such command is du. This command stands for disk usage, represented in short as du. It recursively access all the files and sub folder under a given folder and display the size of each of this items. To display the total size of the folder in MB, GB etc., use the command

du -sh

Option s says du to summarize the results and do not display the details of sub folder and files
Option h says display the size in human readable format i.e., K for kilobytes, M for megabytes & G for gigabytes

Comments

Popular posts from this blog

Delete multiple lines in Linux style Vi Editor

Mysql on XAMPP performance issues and tuning

Change Firefox Browser Default View Source Editor to your Favorite Text Editor