I tried with
lsof -F c somefile
But I get
p1
cinit
p231
cmountall
p314
cupstart-udev-br
p317
cudevd
Instead of
init
mountall
...
Any way to get just the command?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityThis will select lines that begin with the c
tag and print them out after removing the tag.
lsof -F c somefile | sed -n 's/^c//p'
awk
. If you really want to remove it I promise I won't undelete again but please leave it.
Man page says procces ID is always selected.
depending on your need, you may use awk to filter out process
lsof -F c somefile | awk '/^c/ { print substr($0,2)}'