Network Connection Monitoring in Linux: Difference between revisions

From Free Knowledge Base- The DUCK Project
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
 
=== ss ===
  ss            list out all connections.
  ss            list out all connections.
  ss -t          tcp only.   
  ss -t          tcp only.   
Line 9: Line 9:
  ss -pnt        tcp with hostnames not resolved, associated process id's using connection. <- very useful
  ss -pnt        tcp with hostnames not resolved, associated process id's using connection. <- very useful
  ss -s          summary statistics
  ss -s          summary statistics
=== netstat ===
   
   
  netstat -natp  show active Internet connections
  netstat -natp  show active Internet connections
  netstat -tupn
  netstat -tupn
tcpdump -X -i eth0


View established connections and associated programs
View established connections and associated programs
Line 20: Line 20:
continuously updated
continuously updated
  netstat -nputwc
  netstat -nputwc
=== tcpdump ===
tcpdump -X -i eth0
=== lsof ===


View established connections and associated programs type TCP only
View established connections and associated programs type TCP only
  sudo lsof -nP -iTCP -sTCP:ESTABLISHED
  sudo lsof -nP -iTCP -sTCP:ESTABLISHED
=== ethtool ===
To get information about your Ethernet interface, you can use:
ethtool eth0
Replace eth0 with your actual interface name.
=== iftop ===
iftop is a real-time console-based network bandwidth monitoring tool.
sudo iftop

Revision as of 14:56, 11 January 2024

ss

ss             list out all connections.
ss -t          tcp only.  
ss -u          udp only.
ss -x          unix only.
ss -a -A udp   report both "CONNECTED" and "LISTENING" sockets udp
ss -nt         tcp with hostnames not resolved.
ss -ltn        listening sockets only, tcp with hostnames not resolved.
ss -pnt        tcp with hostnames not resolved, associated process id's using connection. <- very useful
ss -s          summary statistics

netstat

netstat -natp  show active Internet connections
netstat -tupn

View established connections and associated programs

sudo netstat -atupen | grep ESTABLISHED
netstat -nputw

continuously updated

netstat -nputwc

tcpdump

tcpdump -X -i eth0

lsof

View established connections and associated programs type TCP only

sudo lsof -nP -iTCP -sTCP:ESTABLISHED

ethtool

To get information about your Ethernet interface, you can use:

ethtool eth0

Replace eth0 with your actual interface name.

iftop

iftop is a real-time console-based network bandwidth monitoring tool.

sudo iftop