LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-19-2008, 01:54 AM   #1
dipuasks
Member
 
Registered: Oct 2005
Location: India
Distribution: Redhat 7-9,Fedora Core 3 - 9, RHEL 4 -5, CentOS 4 - 5, Ubuntu 7.10 - 12.10, Mandirva 2008 -2009
Posts: 133

Rep: Reputation: 16
Question "du" command without recursion


Hello All,

I want to list disk usage of only subdirectories under a directory, but du shows all subdirectories, subdirectories and files under them as well.

Like the below:

[root@localhost Documents]# du -h
4.0K ./dumps/ccna
4.0K ./dumps/rhce
4.1M ./dumps
4.0K ./personal/music
4.0K ./personal/games
7.1M ./personal
5.1M ./books

But what I want is it should only show the totals of only, like below:

4.1M ./dumps
7.1M ./personal
5.1M ./books

Any ideas how to do that? The -S option does not help as per man page.


--------------------------------
Dipu
http://smartdipu.redirectme.net
Try Linux, you'll love it for sure.
 
Old 05-19-2008, 01:58 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122Reputation: 4122
--max-depth=1
 
Old 05-19-2008, 02:12 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by dipuasks View Post
Any ideas how to do that? The -S option does not help as per man page.
What you need is -s (lowercase s).
 
1 members found this post helpful.
Old 05-19-2008, 03:27 AM   #4
Broder
Member
 
Registered: Oct 2006
Location: Santa Barbara, C.A.
Distribution: Mood dependent
Posts: 117

Rep: Reputation: 15
Try:

du -s *
 
Old 05-19-2008, 07:48 AM   #5
dipuasks
Member
 
Registered: Oct 2005
Location: India
Distribution: Redhat 7-9,Fedora Core 3 - 9, RHEL 4 -5, CentOS 4 - 5, Ubuntu 7.10 - 12.10, Mandirva 2008 -2009
Posts: 133

Original Poster
Rep: Reputation: 16
Thumbs up

Quote:
Originally Posted by syg00 View Post
--max-depth=1
This does not show result. The below warning comes.
du: warning: summarizing conflicts with --max-depth=1

I was trying the du -s and du -sh, but only thing I left was the *

Now, du -sh * did it!!

Thanks Broder and everyone!!


----------------------
Dipu
http://smartdipu.redirectme.net
Try Linux, you'll love it for sure.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
C Drive "/dev/hda1" accidently used in dd command at "of=" switch M D Linux - Software 4 04-26-2007 08:56 AM
"list dynamic dependency" of an executable using command other than "ldd" Amrita@3086 Solaris / OpenSolaris 3 04-04-2007 04:56 AM
Tiny Sofa 2.0 - I thought "halt", "reboot" were only root command ?? sorcerer Linux - Distributions 1 08-21-2004 03:28 PM
"segmentation error" when issuing "useradd" command through terminal with RH 9.0 kaihuang Linux - General 0 10-21-2003 11:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration