Created
July 7, 2023 11:59
-
-
Save ukor/7812f973cd34d20e8d019d0ecbbac35b to your computer and use it in GitHub Desktop.
Shell Scripting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [See Stackoverflow Question](https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac) | |
| Add this to your profile | |
| ```sh | |
| findAndKillPort() { | |
| port=$(lsof -n -i4TCP:$1 | grep LISTEN | awk '{ print $2 }') kill -9 $port | |
| } | |
| ``` | |
| - Add alias | |
| ```sh | |
| alias killport=findAndKillPort | |
| ``` | |
| - Usage | |
| ```sh | |
| killport 5000 | |
| ``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment