Orhun Özer
Posted on May 17, 2023
killport() {
if [[ $# -eq 0 ]]; then
echo "Usage: killport <port>"
return 1
fi
local port=$1
local pid=$(lsof -n -i4TCP:"$port" | awk 'NR>1 {print $2}')
if [[ -n $pid ]]; then
kill -9 "$pid"
echo "Process with PID $pid killed."
else
echo "No process found running on port $port."
fi
}
Add this to .zshrc
Call killport 8080
from terminal.
💖 💪 🙅 🚩
Orhun Özer
Posted on May 17, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
python Building a Voice Transcription and Translation App with OpenAI Whisper and Streamlit
November 29, 2024
automation How to automate the launch of your terminal processes (fzf + tmux + teamocil)
November 27, 2024
nextjs Client-Side Search for Static Sites with Strapi, Next.js, Fusejs & Cloudflare
November 27, 2024