Monitoring Ethernet Traffic

March 12th, 2004 by Erich Kolb

Ever wonder what’s going on on your ethernet wire? Well if your good at reading hex, just run tcpdump. Usage: tcpdump -i [ethernet device] For data presented in a more comprehensible manner, check out ethereal.

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Furl

SSH Port Forwarding

March 12th, 2004 by Erich Kolb

You can use SSH to forward ports from one machine to another. This is useful for connecting to a machine that, for example, is behind a firewall. Here is how to do it (remote.host.com is the remote host, local.host.com is the local machine, 9999 is the example remote port, and 22 is the local sshd daemon): $ ssh -g -R 9999:local.host.com:22 root@remote.host.com This sets up a secure connection between port 22 on the local machine and port 9999 on the remote host as user root. Once this is in place, you can connect to remote.host.com from other.host.net: $ ssh -p 9999 remote.host.com and this forwards your connection to port 22 on local.host.com. Super useful!

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Furl

Mirroring Websites

March 11th, 2004 by Erich Kolb

Using wget, you can copy the contents of a whole website to your hard disk. This is done by executing the wget command with the ‘-r’ option. the ‘-r’ option is, as stated in the wget man page, a “Recursive web-suck”, in other words, it mirrors the URL specified at execution time. Usage: wget -r [URL] For more information about wget, refer to its man page.

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Furl

Seek and Destroy

March 11th, 2004 by Erich Kolb

Want to automatically search and destroy core files that might linger on your system? Insert the following line in your /etc/cron.daily directory and make it executable: find / -name core -atime +5 -exec rm -f “{}” ‘;’ This will look for any files named ‘core’ that haven’t been touched in 5 days (and it won’t look in other filesystems) and delete them automatically.

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Furl

Recursive Grep

March 11th, 2004 by Erich Kolb

If you want to search through a list of directories for a string, you can use ‘rgrep’ to get the job done. Rgrep will search through an entire list of sub-directories the same way grep searches through files.

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Furl

Editing Files With a Perl One-Liner

March 11th, 2004 by Erich Kolb

If you have a group of files on which you’d like to perform a search-and-replace edit, try this handy Perl one-liner: $ perl -p -e 's/original/replacement/g' *.html This command will replace all occurences of the string “original” with the string “replacement” in all files named *.html. This command can also work with Perl’s powerful regular expression engine. If you’d like to save an unmodified copy of your files, try change the option like this: $ perl -p -i .bak -e 's/original/replacement/g' *.html This will make a copy of your original files with the .bak extension added, just in case your editing goes wrong.

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Technorati
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Furl