Skip to content

Instantly share code, notes, and snippets.

@Okwori
Last active April 27, 2022 10:57
Show Gist options
  • Save Okwori/85021a63ec44ae1781022b394f68e0d2 to your computer and use it in GitHub Desktop.
Save Okwori/85021a63ec44ae1781022b394f68e0d2 to your computer and use it in GitHub Desktop.
Kill a process from the cmd on windows
## Start cmd as admin
netstat -ano | findstr :3000 # r specify other port number
## Then get the processID from the previous command
taskkill /PID typeyourPIDhere /F # replace 'typeyourPIDhere' with appropraite process ID
## UBUNTU ##
You want to use backtick not regular tick:
sudo kill -9 `sudo lsof -t -i:9001`
If that doesn't work you could also use $() for command interpolation:
sudo kill -9 $(sudo lsof -t -i:9001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment