← Back to context

Comment by sooheon

6 years ago

For the non bash users among us?

There's nothing specifically bash about it, but here's what the components mean:

"kill" = kill running process

"-9" = kill as forcefully as possible

"$(...)" = command substitution: run the stuff inside the brackets and replace this term with the results (it will be the processes to kill in this case).

"lsof" = list open files (other things like ports and devices count as files on Unix systems)

"-i" = search for internet address

":19421" = local machine, port 19421

I think they're missing a "-t" on lsof, to make it output process IDs only ("terse mode") instead of a human-readable table:

  kill -9 $(lsof -t -i :19421)

  • Is lsof part of the default install of OSX? It isn't usually part of the base install on Linux (though obviously very easy to install)

  • although command substitution is in the POSIX sh spec and so not a bashism, $(...) doesn't work in e.g. fish