Custom lsof output
The following command produced the unix domain socket opened by PID 30661
$ sudo lsof -U -a -p 30661
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
haproxy 30661 haproxy 7u unix 0xc784a000 0t0 3348210055 /var/lib/haproxy/stats.30660.tmp
I want a command using lsof internal options to give the output as just "var/lib/haproxy/stats.30660.tmp"
I don't want to use pipe and other tools to get this output.
lsof
's internal formatting options are quite restrictive, in that they insist on prefixing each field with a letter designating that field's meaning. For example,
$ sudo lsof -U -a -p 30661 -Fn
would give
p30661
n/var/lib/haproxy/stats.30660.tmp
The man page says that the process ID is always selected, so there doesn't seem to be a way of only getting the filename (of which there may of course be more than one). I want to give you more options, but you said that you don't want to use pipes or other commands.