scripts/find_big_files.sh

23 lines
504 B
Bash
Raw Normal View History

2011-01-06 14:04:33 +01:00
#!/bin/sh
2011-01-06 14:21:38 +01:00
# Author: Oliver Ladner <oli@lugh.ch>
# License: LGPL
2011-01-06 14:04:33 +01:00
#
# Find and report big files
MIN_SIZE="$1M"
DIRS="/usr /home /etc /bin /var /sbin /tmp"
EXCLUDE=""
# df
DF=$(df -h)
if [ ! $1 ]; then
echo "Usage: $0 <number-in-mb>"
exit 1
else
DO_IT=`find $DIRS -size +$MIN_SIZE -print -exec ls -lha {} \; | grep -v '$EXCLUDE' | awk {'print $5"\t"$6" "$7" "$8'}`
LOL=`echo $DO_IT | wc -l`
if [ "$LOL" -gt "0" ]; then
2013-02-13 14:42:19 +01:00
echo "$DO_IT"
2011-01-06 14:04:33 +01:00
fi
fi