Photo Courtesy: seiho
Kill command is use to send signal to a process or to kill a process. We typically use kill -SIGNAL PID, where you know the PID of the process.
There are other ways to effectively kill a process — killing a process by name, killing a process by specifying part of the name, killing a process by pointing out the process with cursor etc.,
In this article, let us review 4 ways to kill a process.
1. Kill Command – Kill the process by specifying its PID
All the below kill conventions will send the TERM signal to the specified process. For the signals, either the signal name or signal number can be used. You need to lookup the pid for the process and give it as an argument to kill.
$ kill -TERM pid $ kill -SIGTERM pid $ kill -15 pid
Example: Kill the firefox process.
$ ps -ef | grep firefox 1986 ? Sl 7:22 /usr/lib/firefox-3.5.3/firefox $ kill -9 1986
2. Killall Command – Kill processes by name
Instead of specifying a process by its PID, you can specify the name of the process. If more than one process runs with that name, all of them will be killed.
Example: Kill all the firefox processes
$ killall -9 firefox
3. Pkill Command – Send signal to the process based on its name
You can send signal to any process by specifying the full name or partial name. So there is no need for you to find out the PID of the process to send the signal.
Example: Send SIGTERM to all the process which has sample in its name.
$ pkill sample
Pkill Example:
Before sending signal, you can verify which are all the process is matching the criteria using “pgrep -l”, which displays the process ID and process name of the matching processes.
In this example, all the processes are designed to log the signal to signal-log, along with its PID.
$ pgrep -l sample 12406 sample-server.p 12425 sample-server.p 12430 sample-garbagec $ pkill -USR1 sample $ cat signal-log Name: ./sample-server.pl Pid: 12406 Signal Received: USR1 Name: ./sample-server.pl Pid: 12425 Signal Received: USR1 Name: ./sample-garbagecollector.pl Pid: 12430 Signal Received: USR1
Note: The part of name which you specify should be in the character within the first 15 character of the process name.
4. Xkill Command – kill a client by X resource
xkill is the simplest way to kill a malfunctioning program. When you want to kill a process, initiate xkill which will offer an cross-hair cursor. Click on the window with left cursor which will kill that process.
$ xkill Select the window whose client you wish to kill with button 1.... xkill: killing creator of resource 0x1200003
Note: Actually, xkill instructs XServer to terminate the client.
Get free Unix tutorials, tips and tricks straight to your email in-box.
If you enjoyed this article, you might also like..


My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 6 comments… read them below or add one }
You may also mention pgrep utility as an useful companion of pkill.
In KDE Ctrl-Atl-Esc shortcut launches xkill.
I do not know, if a GNOME shortcut does exist.
Dear sir,
I am very much interest to read your tips and examples. at the same time you can publish server configuration related topics and what are the things available in linux like windows toolls team viewer and remote system monitoring tolls. please it is very useful to me i dont know what are the tools available in linux and how to configure.
Nice .. Killl process tips
@Yuri,
Thanks for mentioning about pgrep. You are right. pgrep and pkill goes together. Actually when we do man pkill, we get information about pgrep also.
For those who don’t know about pgrep, following is the snippet from ‘man pgrep’:
pgrep looks through the currently running processes and lists the pro- cess IDs which matches the selection criteria to stdout. All the cri- teria have to match. For example, pgrep -u root sshd will only list the processes called sshd AND owned by root.@Ramesh Raman,
I will write few articles about GUI based server configuration tools available for Linux. I’ve added it in my list of things to do. Thanks for the suggestion.
@Edson,
I’m very glad that you found this article helpful.
wow i didnt know you could do that, thanks a lot!!
Thank you for this – it was very helpful for a newbie like me !