Troubleshooting issues using lsof in Linux

The lsof is an excellent utility that can be used to identify process or user that is locking system resource such as file or network socket.

Basically, The /etc/services system files is usually used to map a numeric port number to a descriptive port name defined by user.


lsof without any command options to list system wide resources that are using by processes running in the system.

To report all processes that are accessing the TCP sockets found on the system
lsof -i TCP

To find out what process is holding TCP port 8080.
lsof -i tcp:8080

To show all resources that are being held by process id 857
lsof -p 857

Some programs might running on the Linux servers by more than one instance. 

In this case, type lsof -c ProgramName instead of lsof -p PID to get a broader scope of view.

For example:

To find out what are the resources held by all sendmail processes running on the system.

lsof -c sendmail

To confirm resources that are being held by user id user1
lsof -u user1

To find out what are the processes that are locking the specify file /home/user1/myfile
lsof /home/user1/myfile

Share this

Related Posts

Next Post »


Write comments
March 29, 2011 at 6:31 AM delete


Your Bolg is very good I know lot of new troubleshootings frm u r blog thanks,

I have one Question with you regarding Linux machine.

Question : Wht is fault light in linux how to check further to resolve this kind of problems.



What do you think about this Article? Add your Opinion..! EmoticonEmoticon