Every 2.0s: netstat -anptu |egrep "^Proto|:80 " Wed May 18 11:03:25 2011 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18418/apache tcp 0 0 64.xxx.183.xxx:80 213.xxx.243.xxx:21370 SYN_RECV - tcp 0 0 64.xxx.183.xxx:80 213.xxx.243.xxx:6465 SYN_RECV - tcp 0 0 64.xxx.202.xxx:80 213.xxx.243.xxx:30703 SYN_RECV - tcp 0 0 64.xxx.202.xxx:80 64.xxx.202.xxx:39600 TIME_WAIT - tcp 0 0 64.xxx.202.xxx:80 64.xxx.202.xxx:39601 TIME_WAIT -
Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?
You must be signed in to comment.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
watch -dn2 'netstat -anptu | egrep "^Proto|:80" | sort'
will watch on ports 80 and 8080 and sort output if u have a lot of connections, highliting changes with update interval 2 sec.