Skip to content

Instantly share code, notes, and snippets.

@msereniti
Last active May 24, 2020 09:32
Show Gist options
  • Save msereniti/4e03bf3db2260f11ca617a97c1a91a11 to your computer and use it in GitHub Desktop.
Save msereniti/4e03bf3db2260f11ca617a97c1a91a11 to your computer and use it in GitHub Desktop.
kill unix process on certain port

Command

kill -9 $(lsof -t -i:8080)

Detailed

To list any process listening to the port 8080:

lsof -i:8080

To kill any process listening to the port 8080:

kill $(lsof -t -i:8080)

or more violently:

kill -9 $(lsof -t -i:8080)

source

Commands copy-paste table for popular ports

port command
8080 kill -9 $(lsof -t -i:8080)
3000 kill -9 $(lsof -t -i:3000)
1234 kill -9 $(lsof -t -i:1234)
80 kill -9 $(lsof -t -i:80)
9000 kill -9 $(lsof -t -i:9000)
3001 kill -9 $(lsof -t -i:3001)
3002 kill -9 $(lsof -t -i:3002)
3003 kill -9 $(lsof -t -i:3003)
9000 kill -9 $(lsof -t -i:9000)
9001 kill -9 $(lsof -t -i:9001)
9002 kill -9 $(lsof -t -i:9002)
8081 kill -9 $(lsof -t -i:8081)
8000 kill -9 $(lsof -t -i:8000)
8001 kill -9 $(lsof -t -i:8001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment