DEV Community

Discussion on: the dreaded port error "bind: address already in use", kill it!

Collapse
 
lbonanomi profile image
lbonanomi • Edited

How about "different, not better"?

fuser -kn tcp $PORT_NUMBER will try to drop a kill -9 on any process using the specified TCP port.

Out of deference to Ben Sinclair's thoughtful counsel you can also specify a signal like this: fuser -$SIGNAL_NUMBER_OR_NAME -kn tcp $PORT_NUMBER

Collapse
 
dechamp profile image
DeChamp

Tried playing around with this and read up on the man page. Seems like it doesn't know about options -k or -n (-kn). I tried variations and none worked.

Collapse
 
lbonanomi profile image
lbonanomi • Edited

How does that old joke about IT standards go, again? : \

The GNU fuser implementation from psmisc accepts -n and -k options, but distribution is far from universal.

Thread Thread
 
dechamp profile image
DeChamp

ya figured that was the case lol.

Thread Thread
 
lbonanomi profile image
lbonanomi