Custom Search

Tuesday, August 4, 2015

Display Linux TCP Connection and Socket Information using netstat and ss commands

Find all cassandra connections (open ports and established TCP connections)
$netstat -vatn | grep 9160
$netstat -vatn | grep 9160 | wc -l
9160 ---> Cassandra port

*use sudo with -p option to see process id
$sudo netstat -vatnp | grep 9160

* list of Active connections

$netstat -n -A inet  | grep 9160
$netstat -n -A inet  | grep 9160 | wc -l

$ss -a | grep 9160
$ss -a | grep 9160  | wc -l

* Display All TCP Sockets
$ss -t -a | grep 9160
$ss -t -a | grep 9160 | wc -l

How Do I Filter Sockets Using TCP States like established, closed, time-wait, etc--

$ ss -4 state established  | grep 9160

http://www.cyberciti.biz/tips/linux-investigate-sockets-network-connections.html



No comments:

Post a Comment