Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jkfran/killport
A command-line tool to easily kill processes running on a specified port.
https://github.com/jkfran/killport
Last synced: 27 days ago
JSON representation
A command-line tool to easily kill processes running on a specified port.
- Host: GitHub
- URL: https://github.com/jkfran/killport
- Owner: jkfran
- License: mit
- Created: 2023-03-17T14:21:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-31T18:21:56.000Z (5 months ago)
- Last Synced: 2024-10-01T23:26:13.535Z (about 1 month ago)
- Language: Rust
- Size: 164 KB
- Stars: 1,680
- Watchers: 10
- Forks: 37
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# killport
`killport` is a command-line utility designed for efficiently terminating processes and containers listening on specified ports. It supports both single and multiple port operations, enhancing system management across Linux, macOS, and Windows platforms. Built with Rust, `killport` combines flexibility with performance in process management tasks.
## Features
- Terminate processes or containers on specified ports with support for single or multiple ports.
- Mode of operation options to target either processes, containers, or both.
- Dry-run capability for safe operations without actual termination.
- Adjustable verbosity for detailed logging and quiet operation for minimal output.
- Comprehensive signal support for fine-grained control over the termination signals sent to processes or containers.
- Cross-platform compatibility: Linux, macOS, and Windows.## Installation
### Using Homebrew
Run the following command to install [killport](https://formulae.brew.sh/formula/killport) using [Homebrew](https://brew.sh/).
```sh
brew install killport
```### Using install.sh
Run the following command to automatically download and install `killport`:
```sh
curl -sL https://bit.ly/killport | sh
```Don't forget to add `$HOME/.local/bin` to your `PATH` environment variable, if it's not already present.
### Using cargo
Run the following command to install killport using cargo. If you don't have cargo, follow the [official Rust installation guide](https://www.rust-lang.org/tools/install).
```sh
cargo install killport
```### Binary Releases
You can download the binary releases for different architectures from the [releases page](https://github.com/jkfran/killport/releases) and manually install them.
## Usage
```sh
killport [OPTIONS] ...
```### Flags
- `-m, --mode `: Select mode of operation (process, container, or both).
- `-s, --signal `: Specify the signal to send (default: SIGKILL).
- `-v, --verbose`: Increase verbosity level (use multiple times for more detail).
- `-q, --quiet`: Decrease verbosity level (use multiple times for less detail).
- `--dry-run`: Preview which processes or containers would be terminated.
- `-h, --help`: Display help message.
- `-V, --version`: Display version information.### Examples
Kill a single process on port 8080:
```sh
killport 8080
```Kill processes on multiple ports with a specific signal:
```sh
killport -s sigterm 8045 8046 8080
```Perform a dry run to check what would be killed on port 8080:
```sh
killport --dry-run 8080
```Supported Signals:
1. **Softest/Lower Preference Signals (Generally ignorable or default to terminate the process gently):**
- `SIGUSR1` - User-defined signal 1
- `SIGUSR2` - User-defined signal 2
- `SIGWINCH` - Window size change
- `SIGURG` - Urgent condition on socket
- `SIGCONT` - Continue if stopped
- `SIGCHLD` - Child status has changed
- `SIGIO` - I/O now possible
- `SIGALRM` - Timer signal
- `SIGVTALRM` - Virtual timer expired
- `SIGPROF` - Profiling timer expired
- `SIGPWR` - Power failure
- `SIGSYS` - Bad argument to routine
- `SIGPIPE` - Broken pipe: write to pipe with no readers
- `SIGTERM` - Termination signal
- `SIGHUP` - Hangup detected on controlling terminal or death of controlling process
- `SIGINT` - This signal is sent to a process by its controlling terminal when a user wishes to interrupt the process.2. **Higher Preference/More Disruptive Signals (Generally not ignorable and often default to terminate the process abruptly):**
- `SIGQUIT` - Quit from keyboard and dump core
- `SIGABRT` - Abort signal from abort()
- `SIGTSTP` - Stop typed at terminal
- `SIGTTIN` - Terminal input for background process
- `SIGTTOU` - Terminal output for background process
- `SIGSTOP` - Stop process
- `SIGSEGV` - Invalid memory reference
- `SIGBUS` - Bus error (bad memory access)
- `SIGFPE` - Floating-point exception
- `SIGILL` - Illegal Instruction
- `SIGTRAP` - Trace/breakpoint trap3. **Most Severe/Definitive Signals (Cannot be caught or ignored):**
- `SIGKILL` - Kill signal## Contributing
We welcome contributions to the killport project! Before you start, please read our [Code of Conduct](CODE_OF_CONDUCT.md) and the [Contributing Guidelines](CONTRIBUTING.md).
To contribute, follow these steps:
1. Fork the repository on GitHub.
2. Clone your fork and create a new branch for your feature or bugfix.
3. Make your changes, following our coding guidelines.
4. Add tests for your changes and ensure all tests pass.
5. Commit your changes, following our commit message guidelines.
6. Push your changes to your fork and create a pull request.We'll review your pull request and provide feedback or merge your changes.
## License
This project is licensed under the [MIT License](LICENSE). See the LICENSE file for more information.