#### Beyond Linux® From Scratch (systemd Edition) - Version 11.1

### Chapter 11. General Utilities

- Prev

  ISO Codes-4.9.0

- Next

  mandoc-1.14.6

- Up
- Home

# lsof-4.94.0

## Introduction to lsof

The lsof package is useful to LiSt Open Files for a given running application or process.

This package is known to build and work properly using an LFS-11.1 platform.

### Package Information

- Download (HTTP): https://github.com/lsof-org/lsof/releases/download/4.94.0/lsof_4.94.0.linux.tar.bz2

- Download MD5 sum: 2a007f86fb0207fbce3e9d7542e1041c

- Download size: 493 KB

- Estimated disk space required: 3.7 MB (add 600 KB for tests)

- Estimated build time: less than 0.1 SBU (add 0.4 SBU for tests)

### lsof Dependencies

#### Required

libtirpc-1.3.2

#### Optional

Nmap-7.92 (with a symbolic link nc pointing to ncat in `/usr/bin`; used in tests)

User Notes: https://wiki.linuxfromscratch.org/blfs/wiki/lsof

## Kernel Configuration

To run the tests, the following option should be enabled in the kernel configuration:

    General setup  --->
      [*] POSIX Message Queues    [CONFIG_POSIX_MQUEUE]

## Installation of lsof

Install lsof by running the following commands:

    ./Configure -n linux &&
    make

The tests should be run as the `root` user. They require that the POSIX message queues are enabled in the kernel, and that Nmap-7.92 be installed with a symbolic link `/usr/bin/nc` pointing to ncat.

    make check

Two tests fail if the tests are run from a script instead of an interactive session.

Now, as the `root` user:

    install -v -m4755 -o root -g root lsof /usr/bin &&
    install -v lsof.8 /usr/share/man/man8

## Command Explanations

./Configure -n linux: Avoid AFS, customization, and inventory checks, and use the linux dialect.

install -m4755 ...: lsof should be suid root to allwo users to list all files. This may be a security threat on some systems. In that case change to `-m755` and use sudo to run the program.

## Contents

Installed Program: lsof
Installed Libraries: None
Installed Directories: None

### Short Descriptions

lsof | lists open files for running processes

Last updated on

- Prev

  ISO Codes-4.9.0

- Next

  mandoc-1.14.6

- Up
- Home