Monday, October 23, 2006

Netstat

This has to be the best command ever! I manage webservers at my work and its probably the most useful command to pull information of who and what is happening on the server from a network ports perspective!

------netstat -r shows you your routing table entries
------netstat -i shows you your network interfaces
------netstat -a shows you what network ports are currently in use on your machine

Use netstat -a regularly and get familiar with the ports that are normally in use on your machine



Amazing Backup statement

I was browsing Digg when I came across this gem. With this one command, you can back up an entire hard drive to a remote machine over ssh.

dd if=/dev/hda.img | ssh -c blowfish user@machine "dd of=hda"


Essentially, you read the hard drive and pipe it to a program on an ssh server that writes the image to a file. Wow. I guess to reverse this process, youd run the reverse command:

ssh -c blowfish user@machine "dd if=hda.img" | dd of=/dev/hda


Im always amazed at how much you can learn from a single command or line of code.