Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a android emulator running on port 5554. I want to continuously watch the netstat output concerning emulator stuff.

Right now I have to manually execute this command every time

sudo netstat -plant | grep emulator

I thought doing something like this would repeat above command automatically every 2 sec.

watch sudo netstat -plant | grep emulator

But instead it hangs the terminal. How to achieve such functionality ? Thanks

share|improve this question
It's unrelated, but why do you use both -l and -a? – m4573r Sep 7 '12 at 7:52
yeah I m only interested in listening port. 'plant' was easy to remember :P – Vihaan Verma Sep 7 '12 at 7:59

Have you tried those options? From the man netstat page:

-c, --continuous
  This will cause netstat to print the selected information every second continuously. 
  Netstat will cycle printing through statistics every delay seconds.

In your case, you can just write:

sudo netstat -cplant | grep emulator
share|improve this answer
No I didn't try that :? . But how to make it display information regarding particular program name ? – Vihaan Verma Sep 7 '12 at 7:56
The same way you did, with a grep. I edited my answer. – m4573r Sep 7 '12 at 8:58

Try that in terminal:

netstat -tuonp
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.