[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

netstat command problem



Hi,

I have a problem with executing

multitail -R 2 -l 'netstat -penta | sort | grep 127.0.0.1:1'

when executed, output looks ok. e.g (attention, long lines, disable
linebreak in client):

tcp        0      0 127.0.0.1:11041         0.0.0.0:*               LISTEN      1003       343281374   13475/sshd: userx
tcp        0      0 127.0.0.1:11055         0.0.0.0:*               LISTEN      1003       341662067   28015/sshd: userx
tcp        0      0 127.0.0.1:11056         0.0.0.0:*               LISTEN      1003       341662077   28015/sshd: userx
tcp        0      0 127.0.0.1:13050         0.0.0.0:*               LISTEN      1003       344739841   29320/sshd: userx

then I login to the server and open another port, what is shown
correctly (last line)

tcp        0      0 127.0.0.1:11041         0.0.0.0:*               LISTEN      1003       343281374   13475/sshd: userx
tcp        0      0 127.0.0.1:11055         0.0.0.0:*               LISTEN      1003       341662067   28015/sshd: userx
tcp        0      0 127.0.0.1:11056         0.0.0.0:*               LISTEN      1003       341662077   28015/sshd: userx
tcp        0      0 127.0.0.1:13050         0.0.0.0:*               LISTEN      1003       344739841   29320/sshd: userx
tcp        0      0 127.0.0.1:11111         0.0.0.0:*               LISTEN      1004       348271289   14654/sshd: userx

however, when I close the port again (log out ssh tunnel), this line
does not go away, therefore showing me wrong information. port is
definitely closed, as netstat command executed in other screen window
does not show that last line.

I tried

multitail -R 2 -L 'netstat -penta | sort | grep 127.0.0.1:1'

but same problem.

using

multitail -r 2 -l 'netstat -penta | sort | grep 127.0.0.1:1'

is not good, because it just appends the command output, what is not
what I want.

I would like to have the same output that is produced with

watch -n 10 'netstat -penta | sort | grep 127.0.0.1:1'

is this possible with multitail, if yes, how do I achieve this?

(I am executing multitail in screen, if this does matter.)

Thank you very much for your attention,
John