Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following command produced the unix domain socket opened by PID 30661

$ sudo lsof -U -a -p 30661
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.

share|improve this question
what have you tried so far? – longneck Jun 10 '13 at 14:28
up vote 2 down vote accepted

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


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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.