Using netstat to view open ports

I've never been an expert at netstat, and it has many options (kinda like ps ;)

I recently read a reply to a query on stackoverflow (thanks to dExIT) , and I thought it was worthy of repeating here.

sudo netstat -tlpn

-l will list listening ports, -p will also display the process, -n will show port numbers instead of names. Add -t to only show TCP ports.

Good stuff.