Forrest logo
back to the lsof tool

lsof:tldr:1ef8a

lsof: List files opened by the given command or process.
$ lsof -c ${process_or_command_name}
try on your machine

The command lsof -c ${process_or_command_name} is used to display information about files that are opened by a specified process or command.

  • lsof stands for "list open files", and it is a command-line utility in Unix-like operating systems (such as Linux) that provides information about files currently opened by processes.
  • -c is an option for lsof that allows users to filter the results based on the specified process or command name.
  • ${process_or_command_name} is a placeholder that should be replaced with the actual name of the process or command you want to investigate.

When you run this command, it will search for files opened by the specified process or command and present a list of them. The information displayed may include the file descriptor (fd), file type, size, mode, device, and file name, among other details.

For example, if you want to find the files opened by the "apache2" process, you would execute: lsof -c apache2. This will provide you with a detailed list of files opened by the Apache web server process.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the lsof tool