Linux: Check which ports are currently occupied

To check which ports are currently occupied and in use by some process on a host use the following command:

netstat -tulpn

This can be filtered down with grep if looking for a particular port.

Note: That this command must be ran as sudo if you are to know the name and process id that is using a particular port.