Title here
Summary here
View files open by PID (using pgrep
in subcommand for convenience):
lsof -p $(pgrep -f "python3 sock_stream_server.py")
View sockets by port or address
lsof -i TCP:22
lsof -i [email protected]
Inspect unix sockets, and even get their type:
~$ lsof -U | grep foo
python3 130385 mierdin 3u unix 0x0000000000000000 0t0 1382094 /tmp/foo.sock type=SEQPACKET
Get unix sockets:
1mierdin@t-bug:~ $ lsof -U | sed -n '1p; /python3/p'
2COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
3python3 100466 mierdin 3u unix 0x000000009cf5d8f7 0t0 231914 /tmp/myunixsocket.sock type=SEQPACKET (LISTEN)
4python3 100466 mierdin 4u unix 0x00000000d52bc0de 0t0 231915 /tmp/myunixsocket.sock type=SEQPACKET (CONNECTED)
5python3 100467 mierdin 3u unix 0x0000000090965ca3 0t0 230698 type=SEQPACKET (CONNECTED)