Saturday 15 February 2014

linux - How to make a Bash function for killing processes accessing a port -


I am trying to simplify killing all the processes on a given port. How can I do this in my .bashrc file using the following command?

  $ lsof -i tcp: 3000 | Awk 'Nr! = 1 {Print $ 2} '|  

Hopefully I can simplify to do something like

  killport 3000  

anything helps Thank you!

something like that?

killport () {lsof -i tcp: $ 1 | Awk 'Nr! = 1 {Print $ 2} '| Shark }


No comments:

Post a Comment