Kill Multiple Processes Using killall
We can also kill all processes with the same name using the killall command
First, let’s create a few processes:
Command:
exec -a process_1 sleep 60000 &
exec -a process_2 sleep 60000 &
exec -a process_3 sleep 60000 &
exec -a process_4 sleep 60000 &
exec -a process_5 sleep 60000 &
Now to kill them:
killall sleep
After executing of the above command, all the newly created processes are being killed in single run.
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.
Contact Us