Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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
   }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: