Solved

AIX -- du is missing the -c flag -- any way to easily get a grand total?

Posted on 2013-06-27
3
529 Views
Last Modified: 2013-07-03
du on AIX is missing the -c flag.   Is there an easy way to get a grand total?
0
Comment
Question by:Xetroximyn
3 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39282152
"du" for a single directory tree shows the total value for the directory in question on the last line,

so if you run "du /tmp" you will see the last line as something like

12345   /tmp

That's the total for /tmp, everything above is detail output and the values are contained in the value shown on the last line.

"du" for several directories ("du /tmp /var" for example) is another case.

You could (additionally?) run such a "du" with the "-s" (= sum) option and add the values like this:

du -s /tmp /var | awk '{sum+=$1; print} END {print sum, "\ttotal"}'

The "coreutils" package in the AIX toolbox collection or from
http://www.perzl.org/aix/index.php?n=Main.Coreutils
contains the GNU version of "du", which supports "-c".
0
 
LVL 26

Expert Comment

by:skullnobrains
ID: 39289510
use '-s' flag instead of '-c'
0
 

Author Closing Comment

by:Xetroximyn
ID: 39298636
ty!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now