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

To avoid any unwanted matches with grep (e.g. ports 1999 and 19999), use:

    $ lsof -i:$port | grep LISTEN
    $ kill $pid


grep isn't necessary at all here:

  lsof -s TCP:LISTEN -i :$port


You could also add the -t option for direct piping to kill.




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

Search: