Skip to content

Instantly share code, notes, and snippets.

@vhbui02
Created May 1, 2023 08:29
Show Gist options
  • Save vhbui02/51d48a1cf075b19775c01b5eea957c60 to your computer and use it in GitHub Desktop.
Save vhbui02/51d48a1cf075b19775c01b5eea957c60 to your computer and use it in GitHub Desktop.
[lsof command] another command that can handle networking by can't remember #linux

lsof stands for list open files, a CLI tool to display infos about the files currently open by processes on a Unix or Unix-like OS.

lsof can be used to identify which processes are using specific files, which files are being used by specific processes, which network connections are open.

Options

-c NAME: filter by process name or command name.

-u NAME: filter by user name or user ID.

-i :port: display only network connections.

-p PID: filter by process ID.

-t: display only the process IDs that match the specified criteria.

Note: this requires root privileges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment