#!/bin/bash # Kill process using the port # Usage: kill-port # # Example: # $ kill-port 3000 # Killed 🔪 if [ $# -eq 0 ] then echo "No arguments supplied: specify port" exit 1 fi pid=`lsof -i :$1 -t` if [ -z "$pid" ] then echo "No pid for port $1" exit 1 fi kill -HUP $pid echo "Killed 🔪"