I need to write lsof
output for several network ports into bash variable.
Simple $(lsof -i :5555)
doesn't work - lsof waits for quit command (Ctrl-C) every time I call it.
I can't figure out how to solve my task.
I need to write lsof
output for several network ports into bash variable.
Simple $(lsof -i :5555)
doesn't work - lsof waits for quit command (Ctrl-C) every time I call it.
I can't figure out how to solve my task.
A long running lsof
process usually means that DNS resolution is timing out or not working correctly which is delaying the output of it.
You can disable DNS resolution by adding the -n
option.
Of course you might want to check out why DNS resolution is taking too long on your server as well.
lsof
takes a long time to complete it is because DNS resolution takes too long. Could that be it? Try adding-n
– faker Apr 03 '14 at 13:07