×


Related to lsof pid


Linux LSOF Command - Explained with Examples

This article covers the usage of the LSOF command in Linux. In fact, With lsof, you can find different processes locking up a file or directory, a process listening on a port, a user's process list, what all files a process is locking.


How to install lsof in Linux ?

lsof isn't available by default on most Linux distributions but can be easily installed. So Use the below command to install lsof:

1. For CentOS / RHEL / Fedora, run the below command:

$ sudo yum install lsof

2. For CentOS/RHEL 8, you can use the DNF command:

$ sudo dnf install lsof

3. For Ubuntu / Debian, run the below command:

$ sudo apt install lsof


How to get lsof supported options ? 

You can get a summarized list of lsof supported options using -? or -h flag:

$ lsof -?