How to Install/Uninstall lsof command on CentOS 8 / RHEL 8

How to Install lsof command on CentOS/RHEL Linux Server

Lsof is used on linux servers to get list of files opened by the running processes. Do the below steps to install lsof command on CentOS / Redhat Server.

1. Log into your CentOS / Redhat Server as ‘root’ user

2. Install lsof command using yum

Command to install lsof command on linux Server :

# Yum install lsof
 

 

root@server [~]# yum install lsof

Resolving Dependencies
–> Running transaction check
—> Package lsof.x86_64 0:4.87-4.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================================
Installing:
lsof x86_64 4.87-4.el7 base 331 k

Transaction Summary
=================================================================================================================================================================================================================================
Install 1 Package

Total download size: 331 k
Installed size: 927 k
Is this ok [y/d/N]: y
Downloading packages:
lsof-4.87-4.el7.x86_64.rpm | 331 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : lsof-4.87-4.el7.x86_64 1/1
Verifying : lsof-4.87-4.el7.x86_64 1/1

Installed:
lsof.x86_64 0:4.87-4.el7

Complete!

 
Lsof command is now installed on the server.
 

How to Uninstall/Remove lsof command from CentOS/RHEL Server

1. Log into server via SSH as ‘root’ user

2. Remove lsof package using yum remove command

Command to remove lsof command from linux server :

# yum remove lsof
 

root@server [~]# yum remove lsof
Loaded plugins: fastestmirror
Resolving Dependencies
–> Running transaction check
—> Package lsof.x86_64 0:4.87-4.el7 will be erased
–> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================================
Removing:
lsof x86_64 4.87-4.el7 installed 927 k

Transaction Summary
=================================================================================================================================================================================================================================
Remove 1 Package

Installed size: 927 k
Is this ok [y/N]: yu
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : lsof-4.87-4.el7.x86_64 1/1
Verifying : lsof-4.87-4.el7.x86_64 1/1

Removed:
lsof.x86_64 0:4.87-4.el7

Complete!

 
 

How to download and install lsof package on CentOS 8 / RHEL 8 server

 
1. Log into your CentOS/Redhat 8 server as ‘root’ user

2. Download lsof package from CentOS website using wget command

3. You can install lsof package either using yum command or rpm command

Yum will download and install the required dependencies.

You must manually download and install the dependencies if you are using rpm command for installing.

—————————
Command to install on CentOS 6 x86_64 server :

# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/lsof-4.82-5.el6.x86_64.rpm

# yum install lsof-4.82-5.el6.x86_64.rpm

OR

# rpm -ivh lsof-4.82-5.el6.x86_64.rpm

 
install lsof centos redhat 6
 

—————————
Command to install on CentOS 7 x86_64 server :

# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/lsof-4.87-6.el7.x86_64.rpm

# yum install lsof-4.87-6.el7.x86_64.rpm

OR

#rpm -ivh lsof-4.87-6.el7.x86_64.rpm

 
install lsof centos redhat 7
 

—————————
Command to install on CentOS 8 x86_64 server :

# wget http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/lsof-4.91-2.el8.x86_64.rpm

# yum install lsof-4.91-2.el8.x86_64.rpm

OR

rpm -ivh lsof-4.91-2.el8.x86_64.rpm

 
install lsof centos redhat 8