1

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?

1

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. – Miserable Variable May 1 '19 at 19:21
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.