Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by nullgeo

1 year ago

One I use a lot is kp, it kills a process listening to a particular TCP port.

  kp () {
           if [ -z "$1" ] then
                   echo "Usage: kp <port>"
                   return 1
           fi
           lsof -nP -iTCP:"$1" -sTCP:LISTEN | awk 'NR>1 {print $2}' | xargs kill -9
   }

0 comments

nullgeo

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities