问题
How do i combine these two commands in the bash:
lsof -i :port
kill pid
The first one returns the PID i want to kill to release the port. The second one kills the returned PID.
I am doing this because I don´t know of any way to kill a jetty webserver within the Netbeans IDE on OSX. Is there a way?
回答1:
You can use $():
kill $(lsof -t -i:port)
回答2:
You can use
kill -9 `lsof -t -i:port`
来源:https://stackoverflow.com/questions/33101725/how-to-combine-lsof-i-port-and-kill-pid-in-bash