Find the answer to your Linux question:
Results 1 to 3 of 3
Is there an easy way to find out the size of the contents of a directory and all it's sub-directories from the command line? Thanks in advance, Dan...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Aug 2005
    Location
    Peterborough, UK
    Posts
    379

    Size of a Directory Tree


    Is there an easy way to find out the size of the contents of a directory and all it's sub-directories from the command line?

    Thanks in advance,
    Dan
    \"I am, after all,\" said Pooh, \"a bear of very little brain.\"
    MY PC: Athlon XP64 3000+ on a Asus K8V-X mobo w/1GB of non-descript RAM. AGP - GeForce 2 MX400. PCI - Creative Live! 5.1 soundcard. 140 GB and 120 GB SATA WD drives.

  2. #2
    Linux Guru dylunio's Avatar
    Join Date
    Aug 2004
    Location
    Cymru
    Posts
    4,157
    If you have /home/foo and you want to find out it's size do
    Code:
    du -h /home/foo
    and it will spit out the size
    Registered Linux User #371543!
    Get force-get May The Source Be With You
    /dev/null
    /dev/null2

  3. #3
    Just Joined!
    Join Date
    Dec 2008
    Posts
    1
    This old post was the top result today when googling "linux directory tree size" - thanks! I'd like to add that adding an -s switch gives a one-line summary total:

    Code:
    # du -hs /var/www/html
    203M    html
    - r

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •