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.
Usage:
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
Basically, The /etc/services system files is usually used to map a numeric port number to a descriptive port name defined by user.
Usage:
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
No comments:
Post a Comment