I know there is a way to run a netstat command on ubuntu so that it keeps updating. Does anyone know? I would like to know when a process opens or closes a socket:
sudo ne开发者_如何学运维tstat -lnp |grep 12239
You can wrap any command in watch
, eg try
watch -n 60 "sudo netstat | head 10"
where you could use your grep
expression instead of head 10
. This now updates every 60 seconds, see man watch
.
精彩评论