Thursday , April 3 2025

How to List Open Files in Linux

In today’s article we will be discussing how to use the “lsof” Command to list open files in Linux.

In the world of Linux, understanding and managing open files is crucial for system administrators and users alike.

The Linux operating system provides a powerful utility called lsof (List Open Files) that allows users to gain insights into the files currently open on their system.

Syntax of List Open Files “lsof”

The basic syntax of the “lsof” command is as follows:

here,

lsof: The command itself, used to list open files.

[options]: Various flags that allow you to customize the behavior of lsof, filtering results by user, process ID, file type, and more.

Common Options Available in ‘lsof’ Command

-c List files opened by a specific process name.
-u Display files opened by a specified user.
-i Show network-related information.
-p List files opened by a specific process ID (PID).
-t Display only the process IDs (PIDs).
-D List files opened by a specific directory.
-R List parent process IDs along with their child processes.

For example, let’s list the open files of the oracle user (root).

Loading

About Onur ARDAHANLI

Leave a Reply

Your email address will not be published. Required fields are marked *