Skip to content

Instantly share code, notes, and snippets.

@MMTE
Forked from ashishsrivastav22/port_killer.sh
Created September 18, 2023 03:36
Show Gist options
  • Save MMTE/5b8613890271e1cf23eed6e5eecfa239 to your computer and use it in GitHub Desktop.
Save MMTE/5b8613890271e1cf23eed6e5eecfa239 to your computer and use it in GitHub Desktop.
Mac Port Killer
#!/usr/bin/env bash
echo -n "Enter Port Number."
read port
if [[ -n ${port//[0-9]/} ]]; then
echo "Invalid Port !!"
fi
lsof -i tcp:$port
processId=`lsof -ti tcp:$port`
echo $processId
kill -9 $processId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment