Solved

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

Posted on 2013-06-27
3
545 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 27

Expert Comment

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

Author Closing Comment

by:Xetroximyn
ID: 39298636
ty!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

685 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