I have an application which uses TCP port 16969. It sometimes requires a quick software kernel reboot on the fly. But if I launch it too fast, I am locked with
I think that:
lsof -i tcp:22 | grep LISTEN | awk '{print $2}' | xargs kill
Should do the trick.
To double check what commands it wants to run before letting it loose add an echo before the kill like this:
lsof -i tcp:22 | grep LISTEN | awk '{print $2}' | xargs echo kill
It'll then list the PIDs that it would ordinarily kill