pgrep which uses the same interface, initially a Solaris command, now found on many other unix-likes including Linux (
procps package)) is to kill processes based on their name.
kills (sends the
SIGTERM signal) to all the processes whose name¹ matches the given regular expression.
pkill node would kill all the processes whose name contains
pkill -x node (
-x like in
pgrep for exact match) to kill processes whose name is exactly
To kill based on pid², it's just
kill (a command built in most shells so it can also be used on shell jobs, but also as a stand-alone utility).
kill 6806 (short for
kill -s TERM 6806) fails, you can as a last-resort try
kill -s KILL 6806 which would terminate it non-gracefully.
¹ process name being a notion that varies a bit depending on the OS. On Linux, it's generally up to the first 15 bytes of the base name of the file that the process (or its closest ancestor) executed, though a process may change it to any arbitrary (but not longer than 15 bytes) value. See also
pkill -f to match on the argument list.
kill can also kill based on process group id.
kill -- -123 sends the SIGTERM signal to all the processes whose process group id is 123. When using the job specification for the
kill builtin of POSIX shells (as in
kill generally also sends signals to a process group.