Skip to content

Instantly share code, notes, and snippets.

@tyrone-sudeium
Created August 18, 2014 01:21
Show Gist options
  • Save tyrone-sudeium/1f8f84a511262e382ccc to your computer and use it in GitHub Desktop.
Save tyrone-sudeium/1f8f84a511262e382ccc to your computer and use it in GitHub Desktop.
Kill processes in zsh using the "john is kill" meme.
function command_not_found_handler() {
if [[ "$1" == *"is kill" ]]; then
FULLCMD="$1"
PROC="${FULLCMD/ is kill/}"
sudo killall "${PROC}"
if [ $? -eq 0 ]; then
echo "\"no\""
fi
else
>&2 echo "zsh: command not found: $1"
exit 127
fi
}
@tyrone-sudeium
Copy link
Author

Add this to your .zshrc file. You can then kill processes like you normally would with killall, for example:

$ "Google Chrome is kill"

If the process was indeed killed, the terminal should then respond with:

"no"

The quote characters are important, because they're actually part of the meme (and also for technical reasons, but those reasons are less funny). I take no responsibility if this damages your computer, or shell, or if it becomes self aware and starts producing an assembly-line of genocidal Terminators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment