Thursday, December 31, 2015

Displaying all active Internet connections in Linux


Linux
It may be necessary to display what Internet connections are active on your Linux box.
For example, seeing if the Apache service is actively running, and if running what network ports it's listening to can be done with the below command:

#netstat -ntap
If you have root privileges running the above command gives an output similar to the example below.

Example output

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 16271/hpiod
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 4917/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8030/apache2
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 15978/cupsd
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 16276/python
tcp6 0 0 :::5900 :::* LISTEN 5752/vino-server
tcp6 0 0 :::22 :::* LISTEN 5062/sshd
tcp6 0 148 ::ffff:192.168.2.102:22 ::ffff:192.168.2.1:3027 ESTABLISHED7534/sshd: hope [
tcp6 0 797 ::ffff:192.168.2.1:5900 ::ffff:192.168.2.1:2592 ESTABLISHED5752/vino-server

Additional information

No comments:

Post a Comment