3.1 C
New York
Saturday, January 18, 2025

Why does lsof -F computer print file descriptors even when they don’t seem to be specified?


I’m utilizing the lsof command to record processes utilizing port 53 on macOS. I need to present solely the method ID (p) and command identify (c) fields, however the output additionally contains file descriptors (f), though I solely requested -F computer.

Right here is the command I’m working:

sudo lsof -nP -i:53 -F computer +c0

Nevertheless, the consequence contains file descriptors:

p21409
cmDNSResponder
f17
f18
f19
f20
f47
p22154
cnc
f3

I solely need to see the method ID and command identify, however the file descriptors are nonetheless being printed.

lsof model:

 % lsof -v       
lsof model data:
    revision: 4.91
    newest revision: ftp://lsof.itap.purdue.edu/pub/instruments/unix/lsof/
    newest FAQ: ftp://lsof.itap.purdue.edu/pub/instruments/unix/lsof/FAQ
    newest man web page: ftp://lsof.itap.purdue.edu/pub/instruments/unix/lsof/lsof_man
    configuration information: libproc-based
    Anybody can record all information.
    /dev warnings are disabled.
    Kernel ID verify is disabled.

Ask:
As a result of lsof print file descriptors (f) after I explicitly specify the -F computer choices? Is that this the anticipated conduct? How can I be certain that solely the method ID and command identify are printed, with out the file descriptors?


Edit:
Once I run the command with out -F computerThat is the consequence I get:

sudo lsof -nP -i:53 +c0
COMMAND         PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
mDNSResponder 21409 _mdnsresponder   17u  IPv4 0x111969c556757e3f      0t0  UDP *:53
mDNSResponder 21409 _mdnsresponder   18u  IPv6 0x5524ed7878be51b4      0t0  UDP *:53
mDNSResponder 21409 _mdnsresponder   19u  IPv4 0xae0066809727a98c      0t0  TCP *:53 (LISTEN)
mDNSResponder 21409 _mdnsresponder   20u  IPv6 0xe4f19df38f2c4a9e      0t0  TCP *:53 (LISTEN)
mDNSResponder 21409 _mdnsresponder   47u  IPv4 0x6981d98eaa5f9130      0t0  TCP 100.114.184.213:53->100.114.184.213:60587 (ESTABLISHED)
nc            22154     mohitkumar    3u  IPv4 0x634de6cd4ff0d2d7      0t0  TCP 100.114.184.213:60587->100.114.184.213:53 (ESTABLISHED)

Related Articles

Latest Articles