Skip to content

on2-dev/killcommand

Repository files navigation

Kill Command

STILL IN BETA

So...I heard some processes of yours aren't behaving!
I will hunt the ones that cross the line and let you know. And if you want them gone, just trust your friend here.

You can specify the threshold to be alerted when any process crosses the line, or even define a limit which should kill any process that dares crossing it!

You're welcome.

image

image

Also, how to kill any process that is using a given port, you ask? Yeah, just let me know which port you want to free and I take care of that for you.

Install

npm install -g killcommand

Running it

killcommand [command] [--options]

Commands

Command Description
start Starts killcommand (Default action if you don't send any command)
stop Stops killcommand, if running
top Shows a list with the current top processes
kill Kills a given command by pid, name or port that it's using.
See examples bellow
list Alias to --list. Shows a list of running processes matching a pattern

Options

Available options:

Option, Alias Description
--stop Stops the current daemon, if any
--list Shows a list of running processes matching a pattern
--help, -h Show this help content
--version, -v Shows the current version
--verbose Show log/debugging messages
--alert <Int> If any process passes this <Int>%, the alert is triggered
Default is 90%
--limit <Int> If any process passes this <Int>%, it is killed on sight
Default is 0% (use 0 to
--interval <Int> Interval time (in seconds) for checking top processes
Default is 5
--ignore [<Str>] A list of programs that are ignored
--alert-ignored Should show the alert, even for ignored programs when they.
cross the line?
--interactive Starts NOT as a daemon, but interactive in the current
terminal. You can use Ctrl+C to exit.

Examples:

Just start it with default options:

~$ killcommand
~$ # OR
~$ killcommand start

Stop it:

~$ killcommand stop

See top processes and their names:

~$ killcommand top

Start daemon ignoring glimpse and blender processes.
Also, will alert if any process reaches 50% of CPU and automatically kill any process that crosses the 80% limit (except the ignored ones):

~$ killcommand --alert=50 --limit=80 --ignore=glimpse --ignore=blender

Ignoring all chrome processes including their renderers

~$ killcommand --ignore="%google%chrome%"

Kills all tabs of brave browser

~$ killcommand kill "%brave%renderer%"

Kills all tabs of brave browser automatically answering yes to any question

~$ killcommand kill "%brave%renderer%" --yes
~$ # OR
~$ killcommand kill "%brave%renderer%" --no-questions-asked

Kills whichever program is listening in port 3000

~$ killcommand kill :3000

Get the name of the process by its PID:

~$ killcommand list 1680

Get the list of processes from "Google Chrome" browser:

~$ killcommand list "chrome"

Get the list of processes from "Google Chrome" browser, but only the renderers (tabs):

~$ killcommand list "chrome%renderer"

Developing

If you want to run it locally while applying changes to it, you can clone the project, then run it like this:

node ./cli.js --interactive --verbose [--other-options]

This way you can see the logs and abort it more easily.

Image credits

Header: Homem vetor criado por freepik - br.freepik.com

Contribute

  • By sending Pull Requests
  • By sending feedback or opening the issues
  • By donating:

Buy us a coffee :)

BTC: 1GuTME1bGbk7hY7ssrUBh3M1k4AeyVCSjW
ETH: 0x49f1612d4a8e9165f2eb94be79af9dbbf3815af5

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published