[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: clean storage device



Hi all,

This is a simple script I wrote for my students.  I'm happy to share it
with you...

It's a bit complicated because I wanted it do deal with filenames
containing spaces.

Suggestions and improvements are welcome.

Joao

============== snip ========== sip ================
DIR="."
KM="m"

usage ()
{
        echo "Usage: `basename $0` [-m|-k|-h] [dirname]"
        exit 1
}

case "$1" in
        -m|-k)
                KM=${1:1:1}
                shift
                ;;
        -*)
                usage
                exit
                ;;
        "")
                DIR="."
                ;;
        *)
                DIR=$@
                ;;
esac

find "$DIR" -maxdepth 1 |
        grep -v '^.$' |
        grep -v "^$@$" |
        while read i; do
                echo "\"$i\""
        done |
        xargs du -sc$KM |
        sort -n
============== snip ========== sip ================

On Seg, 2004-08-16 at 09:59, Mark Janssen wrote:
> On Mon, 2004-08-16 at 10:34, Martin Wegmann wrote:
> > Hello, 
> > 
> > I is rather not a 100% laptop question but it is due to the small storage device on my laptop (30 GB on IBM T40). 
> > I partitioned my harddrive and left 11GB for my / directory. My home directory holds more or less 3 GB, nevertheless do I get into trouble at the moment because the partition is full. 
> > What is filling my / directory? and how do I get rid of these files? The operating system does definitely not use +/- 8 GB because I previously removed  many packages and nothing happened. 
> 
> Check with 'du -s /* | sort -n' where most space is being used, drill
> down from there.
> 
> Try running 'apt-get clean' as root to cleanup old packages
> 
> Run a find for large files 'find / -size +100000000c'
-- 
Joao Lourenco                  Tels: (+351) 212 948 536
Dep. Informatica                     (+351) 212 948 300
FCT / Univ. Nova de Lisboa      Ext: 10740
Quinta da Torre                 Fax: (+351) 212 948 541
P-2829-516 CAPARICA   http://www-asc.di.fct.unl.pt/~jml



Reply to: