K
K
Kamil2021-02-11 21:39:40
linux
Kamil, 2021-02-11 21:39:40

How to output information from netstat to the terminal every second?

Hello.
Can you please tell me how to display information from netstat in the terminal in real time?
For example, the command netstat -na | grep:80 | wc -l , I need it to update itself, every second

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2021-02-11
@Lakika

watch -n 1 "netstat -na | grep :80 | wc -l"

K
Kamil, 2021-02-11
@Lakika

Decided like this, thanks to you
while true; do netstat -na | grep:80 | wc -l | tr '\n' '\r'; sleep1; done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question