Friday, July 20, 2007

finding large files in Linux

I wanted to clean out some old large files on my hard drive. What I needed to help me do this was a listing of files by size. My plan was to find the large files and delete the ones I no longer needed.I used find, sort and less to do this. The code was:
$ find . -printf '%s %h%f' | sort -nr | less

the options in find for print f that I used were %s (size in bytes), %h (directory) and %f (file name)
the options in sort I used were -n (numeric osrt) and r (reverse [high to low].

Once the list was run in a terminal window I opened a second window and removed the files I no longer needed.

0 Comments:

Post a Comment

<< Home