Monitoring open network connections and listening ports on Debian Lenny

To monitor which network connections are established and which ports your Debian Lenny server is listening on, simply run:

sudo lsof -Pi

If this doesn’t work, you might have to install lsof by running the following command:

sudo apt-get install lsof