Andrew's Sprocket

a gear for all facets of life

This is a useful packet grabber using tcpdump.
You don’t get as many details as wireshark or ethereal but running this on a remote server is easier.

First find out what network interface you want to capture.

$ ifconfig

Then start capturing and write to a file with -w

$ tcpdump -i eth0 -w eth0-dump.log

You can then read the file with the -r switch

$ tcpdump -r eth0-dump.log
Google Buzz
  • Share/Bookmark

It is always useful to be able to automate backups. I found some of this out there in the ether and use it often.

#!/bin/bash
dir="/var/www";
# what directory or file to back up
cd ${dir}
 
if [[ $? != 0 ]]; then
   #cd failed, we'll exit with an error message
   echo "Error: could not cd to ${dir}. No backup was created."
   exit 1;
fi;
 
# path to back up folder
tar -zcf /var/www/backups/backup-$(date +%Y%m%d).tar.gz .
Google Buzz
  • Share/Bookmark