When your /var/log/ is full

Posted: 25/08/2013 in Shell tips

I use the following periodically to see if i have some big files on my /var/log/ directory

# find all big files over 1 MB in /var/log and sort them with size
find /var/log -type f -size +1M -exec ls -lh {} \; 2> /dev/null | awk '{ print $NF ": " $5 }' | sort -nk 2,2

and to move all gzipped files from /var/log/ to /var/backuplog/ and make some clean space

find /var/log -iname '*.gz' -exec mv '{}' /var/backuplog/ \
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s