killport() {
if [ $# -ne 0 ]; then
for port in "$@"; do
pids=$(lsof -ti ":$port")
if [ -n "$pids" ]; then
echo "Processes listening on port $port: $pids"
echo "$pids" | xargs kill -9 >/dev/null 2>&1
echo "Processes listening on port $port have been terminated"
else
echo "No process found listening on port $port"
fi
done
else
echo "No arguments provided"
fi
}
~/.bashrc 마지막에 이런걸 만들어주면 굳이 설치하지 않아도...