large files

Posted by david marsh on Wed 14 March 2012

A small script to find large files under current mount point, usefull in linux, probably works in bsd and generic unixes:

1
2
3
4
5
6
7
8
#!/bin/bash
#20091201:dmarsh:find large files under current mount point
#20100413:dmarsh:changed echo cmd to print -u2 so message goes to stderr
set -e
set -u
cmd="/usr/bin/find . -type f -size +1048576c -exec /usr/bin/du -sk {} \; 2>/dev/null | /usr/bin/sort -n"
print -u2 ${cmd}
eval ${cmd}

tags: unix, linux, shell, it