LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Please help me understand this man page. (https://www.linuxquestions.org/questions/linux-software-2/please-help-me-understand-this-man-page-4175536587/)

rookee 03-12-2015 08:39 PM

Please help me understand this man page.
 
I'm trying to understand this man page of lsof on linux. . The following is the excerpt of lsof man page. Can anyone please help me understand what these options mean.

1) the ‘^’ (negated) login name or user ID (UID), specified with the -u option;
2) the ‘^’ (negated) process ID (PID), specified with the -p option;
3) the ‘^’ (negated) process group ID (PGID), specified with the -g option;
4) the ‘^’ (negated) command, specified with the -c option;
5) the (‘^’) negated TCP or UDP protocol state names, specified with the -s [p:s] option.

Also please advise tips on reading and understanding the man pages if there's any. Thanks in advance.

kbp 03-12-2015 09:07 PM

What they're saying is that if you provide multiple options such as user (-u), pid (-p) they are OR'ed by default. This means that if you run:
Code:

lsof -u root -p 666
.. you would see any open files by pid 666 or by user root

If you negate an option such as (any open files NOT open by root):
Code:

lsof -u ^root -p 666
.. the check for user will take effect first before any further filtering is applied.
This means that if pid 666 was running as root it will not show up in the output.

For general guidance with man pages, you'll find that they're usually quite terse and if you are having trouble understanding then try out a few of the options and it'll help clarify how the tool works.

rookee 03-12-2015 09:21 PM

Thank you very much kbp.

jailbait 03-12-2015 09:38 PM

I think that man pages are written much more like a specifications sheet than a text book. The man pages terseness and exactitude seem natural to mathematicians and some programmers but most people find the man pages to be lacking. If you cannot decipher a man page description then I recommend that you use google to find an explanation written like a textbook. In the case of lsof here is a decent human readable explanation:

https://danielmiessler.com/study/lsof/

This explanation has plenty of good examples and it includes an example that explains the part of the lsof man page that stumped you.

-------------------
Steve Stites

rookee 03-12-2015 09:48 PM

Pretty informational.Thanks Jailbait.

veerain 03-13-2015 12:35 AM

Quote:

Originally Posted by jailbait (Post 5331331)
I think that man pages are written much more like a specifications sheet than a text book. The man pages terseness and exactitude seem natural to mathematicians and some programmers but most people find the man pages to be lacking. If you cannot decipher a man page description then I recommend that you use google to find an explanation written like a textbook. In the case of lsof here is a decent human readable explanation:

https://danielmiessler.com/study/lsof/

This explanation has plenty of good examples and it includes an example that explains the part of the lsof man page that stumped you.

-------------------
Steve Stites

They are natural to mathematicians and computer scientists. But it is good at this way. Because it is concise, correct and understandable. Users should try to learn them. For start using more explanatory text do help.


All times are GMT -5. The time now is 07:18 PM.