[SLUG] file size

From: Eben King (eben01@verizon.net)
Date: Fri May 29 2009 - 12:46:12 EDT


If I have a bunch of assorted files, how can I find out their total size?
Quickly is a definite plus, since this will happen hundreds of times.

For example, a list of items comes from

dpkg -L abcde

This can be modified to show just files with

dpkg -L abcde | while read file ; do [[ -f $file ]] && echo $file ; done

How do I find their aggregate size?

See, I'm trying to build a DVR, and I need to uninstall all unnecessary
programs to make more space. The fastest way to do that is to uninstall the
big things first. But, I have to know what they are. I can get a list of
all installed packages with "dpkg-query -l '*' | grep ^ii | tr -s ' ' | cut
-f 2 -d ' '", no problem.

dpkg ... done | du -s

finds the size of ".", du's default directory. No good.

du -s $(dpkg ... done)

finds the size of each file individually. Also no good.

dpkg ... done | xargs du -s

does the same thing as the above when the list is small. I imagine it does
about the same thing when it's large too. Either way, no good.

-- 
-eben    QebWenE01R@vTerYizUonI.nOetP    http://royalty.mine.nu:81
SAGITTARIUS:  All your friends are laughing behind your back... kill
them.  Take down all those naked pictures of Ernest Borgnine you've
got hanging in your den.  -- Weird Al, _Your Horoscope for Today_
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:59:59 EDT