killreg is a Bash script designed for Unix-like operating systems to terminate processes that match a given pattern. It allows for an optional signal specification to control how the processes are terminated.
- Basic Command:
./killreg <PATTERN> - With Signal:
./killreg [-SIGNAL] <PATTERN>
-SIGNAL: An optional signal to send to the matching processes, e.g.,-9for SIGKILL,-TERMfor SIGTERM. Default is-TERM.PATTERN: A required argument. The script will terminate all processes that match this pattern.
- To terminate processes matching
myapp:./killreg myapp - To forcibly terminate processes matching
myapp:./killreg -9 myapp
- Bash shell
- Unix-like operating system
- User must have necessary permissions to terminate the targeted processes.
The script checks for:
- Minimum requirement of one argument.
- Correct format when two arguments are provided (first argument should start with a hyphen).
Use this script with caution as terminating critical system processes can lead to system instability.
This script is provided "as is", without warranty of any kind. Use at your own risk.