lsof


lsof

Purpose

List open files and network connections.

Syntax

lsof [options] [names]

Options

-h displays a Help message.

-c X displays files for commands that begin with letter X.

-i IP shows network connections whose IP address matches IP.

-s shows the file size (when available).

-t displays terse output.

-u names lists the open files for the specified users.

-R lists the parent process ID.

Description

The lsof command displays a list of all the open files for a user. An open file may be a regular file, a directory, a device file, a library, or a network file (Internet socket, NFS file, or UNIX domain socket). You can use this command to see who is using a specific file. You can also use lsof as an intrusion detection tool to browse the current Internet connections and see if there are any unexpected connections.