May 27, 2010

Recursively find the latest modified file

Filed under: Bash, Linux — James @ 10:10 am

find . -printf "%CY-%Cm-%Cd %CH:%CM:%CS\t%p\n" | sort -nr | head -n 1

August 29, 2009

Count unique IP address in Apache’s access log

Filed under: Bash, How To, Linux, Ubuntu — James @ 11:14 pm
sed < /var/log/httpd/access_log -e 's/ .*$//' | sort | uniq -c

November 16, 2008

List files/folders ordered by size

Filed under: Bash, How To, Linux — James @ 11:13 am
du -s * | sort -n

November 11, 2008

Bash script to retry failed command

Filed under: Bash, Programming — James @ 2:09 pm

This was originally developed to retry an rsync command if a network error happened. It’s a mishmash of code found from around the net, and could probably be tidier but it gets the job done.

(more…)