user1984646
user1984646

Reputation: 273

Linux get the size of a folder and its subfolders to a certain depth

In Linux, I have the following folder structure, I want to get the size of the folder and its subfolders to a certain depth.

I have this structure:

/AAAA/BBBB/1111
/AAAA/BBBB/2222
/AAAA/BBBB
/AAAA/CCCC
/AAAA/DDDD/3333
/AAAA/DDDD
/AAAA

du -m, shows me the entire tree, not just 2 levels as I need. What is the proper command?

Upvotes: 16

Views: 38694

Answers (2)

X Tian
X Tian

Reputation: 772

Limit the depth of search --max-depth=N.

Upvotes: 3

Xymostech
Xymostech

Reputation: 9850

You want the -d or --max-depth option.

du -d 2

Upvotes: 35

Related Questions