Kill a Process with the Help of pgrep

Command: 

ps aux | grep process

Here pgrep can be used to go through all processes and match the ones with the given pattern. This way we can easily get the pid of the process and kill it effectively.

Here we don’t want to kill the important process so we will only kill the two processes with their pid

kill 355

kill 355

How to Kill Processes by Given Partial Names in Linux

On a Unix system creates a separate environment for a program when it is executed. Everything the system needs to run the program as if there were no other programs in this environment. In Unix, each command you issue initiates or starts a new process. You initiated a process using the ls command to list the directory contents.
Simply put, a process is a running program instance.  pkill is a utility, preinstalled on most Linux systems, used to terminate processes from the terminal. Processes can be killed using various attributes including partial names. Partial names, snippets, and patterns can surely be used to terminate a process on a Linux machine however it may backfire to kill processes without their unique id. pkill is a powerful command that can terminate/kill processes.

Similar Reads

Kill Processes by Given Partial Names in Linux

We can kill processes by giving partial names in Linux by using 3 different methods:...

Method 1: Kill a Process with the Help of /proc//stat

/proc//stat is a unique file defined for each process and it can be accessed with the process id....

Method 2: Kill a Process with the Help of pgrep

Command:...

Method 3: Kill Multiple Processes Using killall

We can also kill all processes with the same name using the killall command...

Frequently Asked Questions

What is the difference between kill and pkill commands?...

Contact Us