Skip to content

Instantly share code, notes, and snippets.

@danielres
Created November 6, 2019 16:24
Show Gist options
  • Save danielres/d8a9d031b48fe8b400d8aaa2fe8fbdf5 to your computer and use it in GitHub Desktop.
Save danielres/d8a9d031b48fe8b400d8aaa2fe8fbdf5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Finds a process by regexp then terminates
# it, including all subprocesses
# usage: ./terminate <PROCESS_NAME_OR_PATTERN>
kill -TERM -- -$(pgrep -f "$1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment