Useful bash scripts


killport

kill the process that is running on a given port

lsof -nP -i4TCP | grep $1 | while read first pid line
do
	kill -9 $pid
done

Usage: killport 8080

listport

list the process that is running on a given port

lsof -nP -i4TCP | grep $1 | while read first pid line
do
	echo $first $pid $line
done

Usage: listport 8080

Leave a comment