Jump to content

Directory size?


Recommended Posts

Try .....filelight.... excellent visual presentation and in depth detail of file sizes. Also shows percentages. Invaluable.

 

I always install it, and have done for years.

 

Cheers. John.

Edited by AussieJohn
Link to comment
Share on other sites

From the console I use:

 

du -sh `ls`

 

for example, if I was in /home/username at the time, I would see the total size for Documents, Downloads, Music, etc, etc. The -sh for du command gives summary and human readable format of directory sizes from the directory listing provided by the command ls. The single angled quote is important.

Link to comment
Share on other sites

Here's a bash script I either wrote or picked up somewhere a long time ago that will give the directory size in bytes of the current directory:

 

#!/bin/bash

## Script gives size of current directory in Bytes when executed

let TotalBytes=0

for Bytes in $(ls -laR | grep "^-" | awk '{ print $5 }')
do
  let TotalBytes=$TotalBytes+$Bytes
done

echo  "${TotalBytes}"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...