scatterd-dotfiles/bin/clear-port
2022-05-08 12:05:30 -04:00

15 lines
244 B
Bash
Executable file

#!/bin/sh
# Kills the process running on the provided port
#
# clear-port 3000
if [ -n "$1" ]; then
port_num="$(lsof -ti4TCP:"$1")"
if [ $? -eq 0 ]; then
kill "$port_num"
fi
else
echo >&2 Usage: clear-port port-number
exit 1
fi