How To Find File And Folder Size in Linux Command Line Interface

FREQUENTLY ASKED QUESTIONS (Linux Commands)
Q: How to find the total size of a directory in command mode?


The du (disk usage) command is most simple and commonly used for checking the size of files and directories. The output of the command shows the total size used by the file/folder.

Find Directory size
[root@server ~]# du /home/admin
The above command displays the total size of the directory "/home/admin" in Bytes


[root@server ~]# du -sh /home
953M    /home
Above command displays "/home/admin" directory size in Mega bytes.


Find File size
To find the file size of /home/admin/Picture.jpg
[root@server ~]# du /home/admin/Picture.jpg
652     Picture.jpg


[root@server ~]# du -sh /home/admin/Picture.jpg
652K     Picture.jpg


Display with Modified Date & time
[root@server ~]# du --time -sh /home/admin/Desktop
9.2M    2012-03-13 10:57        /home/admin/Desktop


Popular Arguments
  • -s                Summarize
  • -h                In Human readable form
  • --time          Display fime mofified time
  • -c                Dimplay grand total
  • -b                Display size in bytes
  • -a                Count all files




Was this helpfull ?

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons