• find a specific entry in my logfile and get the user agent for that entry:
    grep \/email-addresses /var/logfiles/httpd-access.log | awk '{print $12}' | uniq
  • find unique ip addresses in the logfile:
    cat /var/log/httpd-access.log | awk '{print $1}' | uniq | sort
  • get a count of unique ip addresses in the logfile:
    cat /var/log/httpd-access.log | awk '{print $1}' | uniq | wc -l
  • grab the 11th - 20th lines in a file:
    head -20 file | tail -10
  • if you give multiple arguments to tail, you can track several log files in the same window:
    tail -f /var/log/mail.log /var/log/apache/error_log
  • wget: ahhhhh the powerful kungfu of wget:
    here are some of my favorite flags:
    -r = recursively
    -l# = # of levels deep to go
    -H = span domains - traverse external links
    -t =
    -nd = plop it into one directory instead of mirroring the directory structure
    -N = timestamping - only download the newer file
    -np = no parent - don't go up the directory
    -A = download only N extension
    -erobots=off = adhere to (on) or ignore (off) robots.txt
    -w# = wait # seconds
    -t# = # of tries
    wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off
  • want to know about the five processes that are consuming the most CPU time on your system:
    ps -eo user,pcpu,pid,cmd | sort -r -k2 | head -6