netstat - grep - tail -f output log
I'm trying to write a script that will tail to a log. I want to monitor my localmachine listening ports.
I was working with this here: Code:
netstat -anp | grep 0.0.0.0:* | grep LISTEN I've tried this: Code:
netstat -anpo 7 | grep 0.0.0.0:* | grep LISTEN Oh and I have tried this: Code:
netstat -anpo 7 >/tmp/test12 | grep "LISTEN" | grep "0.0.0.0:*" | tail -f /tmp/test12 |
take a look at netstats c option: netstat -anpc | grep 0.0.0.0:* | grep LISTEN
can be found in the manpage |
Quote:
Do think I should loop this..? |
If you want to monitor the changes in the output of netstat from a terminal, take a look at the watch command:
Code:
watch -n7 'netstat -anp | grep -w LISTEN' Code:
#!/bin/bash |
Quote:
|
All times are GMT -5. The time now is 08:38 PM. |