
Terminal - Commands using netstat - 96 results
netstat -nut | sed '/ESTABLISHED/!d;s/.*[\t ]\+\(.*\):.*/\1/' | sort -u
This is sample output - yours may be different.
netstat -nut | awk '$NF=="ESTABLISHED" {print $5}' | cut -d: -f1 | sort -u
This is sample output - yours may be different.
81.91.145.204
85.133.199.175
85.185.21.146
91.186.200.13
91.189.90.40
91.98.155.188
91.99.41.81
92.50.59.10
94.182.63.188
find all computer connected to my host through TCP connection
netstat -lantp | grep ESTABLISHED |awk '{print $5}' | awk -F: '{print $1}' | sort -u
This is sample output - yours may be different.
91.186.200.150
92.42.55.172
94.127.72.60
94.182.150.25
94.182.156.230
94.184.255.134
95.38.45.133
find all computer connected to my host through TCP connection.
netstat -nt | awk -F":" '{print $2}' | sort | uniq -c
This is sample output - yours may be different.
count connections, group by IP and port
netstat -ntu | awk ' $5 ~ /^[0-9]/ {print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
This is sample output - yours may be different.
netstat has two lines of headers:
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Added a filter in the awk command to remove them
netstat -ntu | awk ' $5 ~ /^[0-9]/ {print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
This is sample output - yours may be different.
netstat -nt | awk '{print $6}' | sort | uniq -c | sort -n -k 1 -r
This is sample output - yours may be different.
36 ESTABLISHED
643 CLOSE_WAIT
1 Foreign
1
Useful for checking the number and state of TCP connections.
netstat -n -f inet|awk '/\.389/{print $2}'|cut -f1-4 -d.|sort -u
This is sample output - yours may be different.
This is sample output - yours may be different.
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
This is sample output - yours may be different.
This is sample output - yours may be different.
while sleep 1; do date; (netstat -a -n | grep 80) ; done
This is sample output - yours may be different.
netstat -a -o -n | grep 8080
This is sample output - yours may be different.
I cannot run Tomcat from Eclipse. It says that there?s other process that is running on port 8080, but I don?t know what is the process, and how to stop it from the Services manger in Windows. So here?s how you can kill and find out what is that process:
To find out what PID 8080 was (hopefully not a trojan)
I typed tasklist /FI ?PID eq 8080″
taskkill /F /PID 2600
This is sample output - yours may be different.
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6012 0.0.0.0:* LISTEN -
tcp 0 0 :::111 :::* LISTEN -
tcp 0 0 :::5556 :::* LISTEN 20921/java
tcp 0 0 :::22 :::* LISTEN -
tcp 0 0 ::1:631 :::* LISTEN -
tcp 0 0 127.0.0.2:7001 :::* LISTEN 20842/java
tcp 0 0 127.0.0.1:7001 :::* LISTEN 20842/java
tcp 0 0 10.249.135.171:7001 :::* LISTEN 20842/java
tcp 0 0 ::1:7001 :::* LISTEN 20842/java
tcp 0 0 fe80::7a2b:cbff:fe:7001 :::* LISTEN 20842/java
tcp 0 0 ::1:25 :::* LISTEN -
tcp 0 0 ::1:6010 :::* LISTEN -
tcp 0 0 ::1:6011 :::* LISTEN -
tcp 0 0 ::1:6012 :::* LISTEN -
udp 0 0 0.0.0.0:111 0.0.0.0:* -
udp 0 0 0.0.0.0:631 0.0.0.0:* -
udp 0 0 0.0.0.0:670 0.0.0.0:* -
udp 0 0 0.0.0.0:26791 0.0.0.0:* -
udp 0 0 0.0.0.0:5353 0.0.0.0:* -
udp 0 0 0.0.0.0:39640 0.0.0.0:* -
udp 0 0 :::111 :::* -
udp 0 0 :::546 :::* -
udp 0 0 :::670 :::* -
udp 0 0 :::43339 :::* -
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:6012 0.0.0.0:* LISTEN -
tcp 0 0 :::111 :::* LISTEN -
tcp 0 0 :::5556 :::* LISTEN 20921/java
tcp 0 0 :::22 :::* LISTEN -
tcp 0 0 ::1:631 :::* LISTEN -
tcp 0 0 127.0.0.2:7001 :::* LISTEN 20842/java
tcp 0 0 127.0.0.1:7001 :::* LISTEN 20842/java
tcp 0 0 10.249.135.171:7001 :::* LISTEN 20842/java
tcp 0 0 ::1:7001 :::* LISTEN 20842/java
tcp 0 0 fe80::7a2b:cbff:fe:7001 :::* LISTEN 20842/java
tcp 0 0 ::1:25 :::* LISTEN -
tcp 0 0 ::1:6010 :::* LISTEN -
tcp 0 0 ::1:6011 :::* LISTEN -
tcp 0 0 ::1:6012 :::* LISTEN -
udp 0 0 0.0.0.0:111 0.0.0.0:* -
udp 0 0 0.0.0.0:631 0.0.0.0:* -
udp 0 0 0.0.0.0:670 0.0.0.0:* -
udp 0 0 0.0.0.0:26791 0.0.0.0:* -
udp 0 0 0.0.0.0:5353 0.0.0.0:* -
udp 0 0 0.0.0.0:39640 0.0.0.0:* -
udp 0 0 :::111 :::* -
udp 0 0 :::546 :::* -
udp 0 0 :::670 :::* -
udp 0 0 :::43339 :::* -
shows opened ports on machine in continuous mode (refreshing every 10 sec)
(netstat -atn | awk '{printf "%s\n%s\n", $4, $4}' | grep -oE '[0-9]*$'; seq 32768 61000) | sort -n | uniq -u | head -n 1
This is sample output - yours may be different.
netstat -atn | perl -ane 'if ( $F[3] =~ /(\d+)$/ ) { $x{$1}=1 } END{ print( (grep {!$x{$_}} 32768..61000)[0] . "\n" )}'
This is sample output - yours may be different.
netstat -atn | perl -0777 -ne '@ports = /tcp.*?\:(\d+)\s+/imsg ; for $port (32768..61000) {if(!grep(/^$port$/, @ports)) { print $port; last } }'
This is sample output - yours may be different.
Not really better - just different ;)
There's probably a really simple solution out there somewhere...
netstat -lnp6 | grep :8080 | sed 's#^[^\/]*/\([a-z0-9]*\)#\1#'
This is sample output - yours may be different.
Gets the application's name that's listening from the port 8080 through IPv6
netstat -n | grep '^tcp.*<IP>:<PORT>' | tr " " | awk 'BEGIN{FS="( |:)"}{print $6}' | sort | uniq -c | sort -n -k1 | awk '{if ($1 >= 10){print $2}}'
This is sample output - yours may be different.
This command is primarily going to work on linux boxes.
and needs to be changed, for example
IP=10\.194\.194\.2
PORT=389
This is sample output - yours may be different.
netstat -rn | awk '/UG/{print $2}'
This is sample output - yours may be different.
Tested on CentOS, Ubuntu, and MacOS.
netstat -rn | grep UG | tr -s " " | cut -d" " -f2
This is sample output - yours may be different.
This is sample output - yours may be different.
netstat -l -p --tcp | egrep -e 'www.*[0-9]{3,4}\/(apache2|httpd)' | awk '{print$7}'
This is sample output - yours may be different.
netstat -an | grep ESTABLISHED | awk '\''{print $5}'\'' | awk -F: '\''{print $1}'\'' | sort | uniq -c | awk '\''{ printf("%s\t%s\t",$2,$1); for (i = 0; i < $1; i++) {printf("*")}; print ""}'\''
This is sample output - yours may be different.
Displays a connection histogram of active tcp connections. Works even better under an alias. Thanks @Areis1 for sharing this one.