I am trying to find out if lsof is part of a typical RHEL installation. I see lsof mentioned in a RHEL page titled Common administrative commands in Red Hat Enterprise Linux 5, 6, 7, and 8 but I do not know enough about Linux administration to know whether this means it will always be there or that it may need to be installed.

I am trying to find this out so I can decide if I need to advise uses to install it, or if they (and my script) can assume it will be there.

On a related note, how do I find out everything that a distro would have?

  • how about RHEL 9? can't install lsof with yum install lsof, get error Error: Unable to find a match: lsof
    – Bill
    Sep 11, 2023 at 4:22

2 Answers 2


Your script probably needs to run as root to take full advantage of lsof. In that case, this would suffice:

#! /usr/bin/env bash

which lsof  > /dev/null || (echo Installing lsof. && yum install lsof)

It's probably enough for your documentation to mention that lsof will be installed if missing.

how do I find out everything that a distro would have?

$ yum list, in a VM that you installed with just the defaults.

  • Thanks. I should have mentioned that I want to know contents of a distro without having to install it. May 1, 2019 at 19:21

It does not appear to be installed by default. On a new installation of RHEL 7 I ran

yum list | grep lsof
lsof.x86_64                         4.87-6.el7           rhel-7-server-rhui-rpms

yum list installed | grep lsof
<nothing returned>

This might be important to know with installations for some versions of Solr for example. You can install it with

yum install lsof

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .