A simple Bash script to kill processes by port number with a single command.
- Find and kill processes running on a specific port with a single command.
- Defaults to killing processes on port
3000
if no port is provided. - Lightweight and easy to use.
-
Download the Script
wget https://raw.githubusercontent.com/vinybk/killport/main/killport
-
Make it Executable
chmod +x killport
-
(Optional) Add to PATH for Easy Access Move the script to a directory in your system's PATH:
sudo mv killport /usr/local/bin/
This allows you to run
killport
from anywhere.
To kill a process running on port 3000
:
killport
To kill a process on a different port:
killport <port_number>
Example:
killport 8080
- If a process is found and killed:
Killed process [process_name] running on port [port_number]
- If no process is found on the port:
No process found running on port [port_number]
- Linux with Bash installed.
lsof
command available (most Linux distributions include it by default).
- If you frequently kill processes on a specific port, consider aliasing the script in your
.bashrc
or.zshrc
:Runalias killnode='killport 3000'
source ~/.bashrc
orsource ~/.zshrc
to apply changes.
Contributions are welcome! If you'd like to add features or improve the script:
- Fork the repository.
- Make your changes.
- Submit a pull request.
This project is licensed under the MIT License.