Forrest logo
back to the nc tool

nc:tldr:b5025

nc: Keep the server up after the client detaches.
$ nc -k -l ${port}
try on your machine

The command "nc -k -l ${port}" makes use of the nc (netcat) utility to create a listening network socket on a specified port.

Here's a breakdown of the command and its options/arguments:

  • "nc" is the command itself, which stands for netcat.
  • "-k" is an option that instructs netcat to keep the listening socket open even if a connection is closed or dropped. It allows the socket to be reused for subsequent connections.
  • "-l" is another option that tells netcat to listen for incoming connections.
  • "${port}" is a placeholder that represents the port number on which the listening socket will be created. It should be replaced with the desired port number.

In summary, this command uses netcat to create a persistent listening socket on the specified port. It is commonly used for various network-related tasks, such as creating a simple TCP/IP server or testing network connectivity.

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 nc tool