Forrest logo
back to the lsof tool

lsof:tldr:ceae6

lsof: Find the process that is listening on a local IPv6 TCP port and don't convert network or port numbers.
$ lsof -i6TCP:${port} -sTCP:LISTEN -n -P
try on your machine

The command lsof is used to list open files and the files that are being used by active processes in a Unix-like operating system.

Here is the breakdown of the command:

lsof: is the command itself, used to list open files.

-i6TCP:${port}: specifies the internet address and port number, where ${port} should be replaced with the specific port number you want to check. The -i flag is used to filter internet addresses and protocols, and 6 denotes IPv6. The TCP protocol means it will filter for TCP connections only.

-sTCP:LISTEN: filters the output to only show the processes that are listening for connections. The TCP:LISTEN parameter means that it will only display the processes in a listening state for TCP connections.

-n: disables the translation of IP addresses to hostnames. This prevents the command from performing reverse DNS lookups and speeds up the execution.

-P: disables the translation of port numbers to service names. Similar to -n, this flag prevents the command from performing port-to-service name lookups.

In summary, this command will list all the open files associated with a specific IPv6 TCP port that is currently in a listening state. The -n and -P options are used to speed up the execution by avoiding unnecessary DNS and service name lookups.

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