Kill processes gracefully using escalating signals.
murder [OPTIONS] TARGETTARGET- Process identifier, can be:- PID (e.g.,
1234) - Name (e.g.,
node) - Port (e.g.,
:8080or8080)
- PID (e.g.,
-h, --help- Show help message and exit-f, --force- Skip confirmation prompts-r, --allow-root- Allow killing root-owned processes
This script terminates processes using an escalating signal strategy:
- SIGTERM (15) - graceful shutdown, 3s wait
- SIGINT (2) - interrupt, 3s wait
- SIGHUP (1) - hangup, 4s wait
- SIGKILL (9) - force kill
When killing by name or port, the script shows matching processes and asks for confirmation before terminating each one (unless -f is used).
For safety, the script refuses to kill root-owned processes unless the --allow-root flag is explicitly provided.
- Standard Unix utilities:
ps,kill,lsof(for port-based killing)
Kill a specific process by PID:
murder 1234Kill all processes matching a name:
murder nodeKill the process listening on a specific port:
murder :8080
# or
murder 8080Kill all Python processes without confirmation:
murder -f pythonKill a process even if owned by root:
murder -r 1234
# or
murder --allow-root 1234Kill all node processes including root-owned:
murder --allow-root nodeShow help:
murder --help0- Successfully killed target process(es)1- Error occurred or no processes found
The script gives processes time to shut down gracefully:
- SIGTERM allows processes to clean up resources and exit normally
- SIGINT simulates Ctrl+C keyboard interrupt
- SIGHUP signals hangup, useful for daemons
- SIGKILL forcefully terminates if all else fails (cannot be caught or ignored)
- Prevents self-termination
- Refuses to kill root-owned processes without explicit
--allow-rootflag - Shows process details before killing
- Interactive confirmation for batch operations (name/port)
- Validates inputs before attempting to kill