Forrest logo
back to the kill tool

shell:warp:d9ecb

Kill processes at port
$ kill $(lsof -t -i:${port})
try on your machine

The command "kill $(lsof -t -i:${port})" is used to terminate a process that is listening on a specific port.

Here is a breakdown of the command:

  1. lsof -t -i:${port}: This part of the command uses the "lsof" (list open files) utility to find the process ID (PID) of the process that is using the specified port. The -t option tells "lsof" to only output the PID, and the -i:${port} specifies the port number that we want to check.

  2. $(...): This is a command substitution, which means the output of the enclosed command is substituted into the main command.

  3. kill: The "kill" command is used to send a signal to a process. In this case, we want to terminate the process.

So, when this command is executed, it will find the PID of the process listening on the specified port using "lsof", and then pass that PID to the "kill" command, which will send a termination signal to that process, forcefully terminating it.

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