1835038 Members
3404 Online
110073 Solutions
New Discussion

syntax of lsof command

 
SOLVED
Go to solution
Shivkumar
Super Advisor

syntax of lsof command

Hi,

I want to track the hung application process or file descriptors which are not being closed gracefully or processes opened for more than required period and become unresponsive.

I want to use #lsof command. I want to store the result in a file to analyze later.

Can someone suggest a good sytax of the lsof command to accomplish the above ?

Thanks,
Shiv




2 REPLIES 2
Steven E. Protter
Exalted Contributor
Solution

Re: syntax of lsof command

Shalom Shiv,

Here is some sample output:

view 29810 root mem VREG 64,0x7 1568768 7257 /usr/lib/libc.2
view 29810 root mem VREG 64,0x7 241664 22103 /usr/lib/dld.sl


Note there is a definite fileystem listed /usr

I would say to begin, what is the filesystem your application is running in?

Lets say its /webshere

So:

lsof | grep webshere

Other possibilities:

lsof -c c
# everything with command beginning with the letter c.

Perhaps w for webshere in this case.

+d s
# Open instances of directory s

I'm giving examples but how to proceed will depend heavily on how your system is setup.

I'm reading through the man page also.

A combination of looking at how the system is structured and looking for interesting options on the man page will get you going.

How did the tusc thing work out?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Shivkumar
Super Advisor

Re: syntax of lsof command

SEP; Thanks a lot for providing very useful syntax on tusc. tusc is not installed on the system. I will install it and test the command provided by you.

Regards,
Shiv