[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with 'du' command

From: Bob Proulx
Subject: Re: Need help with 'du' command
Date: Sat, 17 May 2003 09:34:02 -0600
User-agent: Mutt/1.3.28i

Dr. Jones wrote:
> I want to do the following:
> List the size of each primary directory off / root, listing the size in
> human readable form, i.e., /usr 400mb /var 1.2 gb and so forth, without
> listing every file, or every subdirectory.

If I understand you correctly then I think this is what you want to
do.  Try this.

  cd /
  du -sh *

The '*' expands to match all of the names of all of the directories
off of the / root.  (It also includes non-directories.)  It prints the
size in -s summary form of only the top level and in human readable
sizes.  If you want to list only directories then using find or ls to
do that turns the command into this.  Try this.

  du -sh $(find . -maxdepth 1 -type d -print)

Alternate method of listing only dirs.

  du -sh $(ls -l | awk '/^d/{print$9}')

Hope this helps,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]