Solved

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

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ubuntu not booting - How get past GRUB? 3 57
linux redhat 7.2 10 89
Quickest way to query Windows Event ID from a Linux Device 3 51
expand ext4 on centos 6 5 37
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 how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

839 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