Skip to content

Simple bash script to kill a process which uses the specified port

License

Notifications You must be signed in to change notification settings

xtrasimplicity/killport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

killport

Simple bash script to kill a process which uses the specified port.

Installation

Simply make a directory in which to store the script, i.e. /opt/scripts/killport, clone this repository therein, set the script to executable, and add this path your $PATH environment variable, as follows:

mkdir -p /opt/scripts/killport && cd /opt/scripts/killport 
git clone https://github.com/xtrasimplicity/killport.git .
chmod +x killport
echo 'export PATH="$PATH:/opt/scripts/killport"' >> ~/.bashrc
source ~/.bashrc

Usage

Simply run killport as follows:

killport PORT_NUMBER

i.e. killport 3000

By default, killport sends each process a SIGTERM signal, allowing the process to gracefully terminate. If you want to forcefully terminate the process, you can pass the -f option to have killport send a SIGKILL signal.

i.e. killport -f 3000

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

About

Simple bash script to kill a process which uses the specified port

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages