Re: [SLUG] file size

From: Eben King (eben01@verizon.net)
Date: Fri May 29 2009 - 16:31:25 EDT


On Fri, 29 May 2009, Paul Bransford wrote:

> Eben King wrote:
>> If I have a bunch of assorted files, how can I find out their total
>> size?

Here's one way:

#! /bin/sh

dpkg-query -l '*' \
grep ^ii \
| tr -s ' ' \
| cut -f 2 -d ' ' \
| while read package ; do
   size=$(dpkg -L $package \
   | while read file ; do
     [ -f "$file" ] && echo "$file"
   done \
   | tr '\n' '\0' \
   | du -cs --files0-from=- \
   | tail -1 \
   | cut -f 1 -d ' ')
   echo $size $package
done \
| sort -rn

-- 
-eben   QebWenE01R@vTerYizUonI.nOetP   royalty.mine.nu:81

Unix is user-friendly; it's just picky about who it makes friends with. ----------------------------------------------------------------------- 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 - 20:00:28 EDT