Polls fos network port usage

while sleep 1; do date; (netstat -a -n | grep 80) ; done

By: hute37
2011-05-16 07:56:56

1 Alternatives + Submit Alt

  • Shows updated status in a terminal window for connections to port '80' in a human-friendly form. Use 'watch -n1' to update every second, and 'watch -d' to highlight changes between updates. If you wish for status updates on a port other than '80', always remember to put a space afterwards so that ":80" will not match ":8080". Show Sample Output

    watch 'netstat -anptu |egrep "^Proto|:80 "'
    Mozai · 2011-05-18 15:05:52 4

What Others Think

watch lsof -i :80
zolden · 580 weeks and 4 days ago
netstat already has '-c' option for continuous (once-per-second) output. You can pipe the output to grep, no need for subshells. zolden has the right idea: for human-readable status updates, use /usr/bin/watch. Furthermore, 'grep 80' will also match ports 8000 and 8080, process IDs 80 and 800, and any IP address with '.80' in it.
Mozai · 580 weeks and 1 day ago

What do you think?

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.

What's this?

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.

Share Your Commands

Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: