Find PID running on a port # .zshrc port-to-pid() { lsof -i:$1 -Fp | sed 's/^p//' | head -n 1 } port-to-pid 3000 # {PID}