Linux Commands

By Phil Frilling, 16 October, 2015

Finding failed login attempts from the maillog:


head -n1 /var/log/maillog | awk '{ printf "Failed Login Attempts Since: "$1" "$2": " }' && cat /var/log/maillog | grep "FAILED" | wc -l && cat /var/log/maillog | grep "FAILED" | perl -ne 'print "$&\n" while m#\d+\.\d+\.\d+\.\d+#g' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | uniq -c | awk 'length($1)>2'
By Phil Frilling, 2 August, 2013

I find myself searching for these commands more often than I should. So, until my mush brain remembers these I'll write them down here.

Archive a directory

tar -zcvf .tar.gz /DIR/You/WANT/TO/ARCHIVE 

Extract .tar.gz file