Master Linux Process Management: How to Use kill, pkill, and killall Effectively
This guide explains how to terminate unresponsive Linux applications using the kill family of commands, covering signal types, command syntax, PID discovery, and advanced tools like pkill, killall, and xkill, with practical examples and safety tips.
Kill Command and Signals
When a Linux (or macOS) application becomes unresponsive, you can force it to exit by sending a signal with the kill command. Linux defines about 60 signals, but the most commonly used are SIGTERM (signal 15) and SIGKILL (signal 9).
kill -l
The command above lists all available signals.
SIGTERM – Requests graceful termination; the process can catch or ignore it and perform cleanup.
SIGKILL – Forces immediate termination; the process cannot ignore it and any unsaved data is lost.
Using kill
The basic syntax is:
kill [signal] PID(s)
If no signal is specified, SIGTERM is used by default. To force termination you can run:
kill SIGKILL 1234
or the shorthand:
kill -9 1234
Finding Process IDs
If you do not know the PID, list running processes with:
ps ux
This displays each process together with its PID.
Killing Multiple Processes
You can terminate several processes in one command by providing multiple PIDs:
kill -9 1111 2222 3333
Using pkill
pkillallows you to kill processes by name, supporting regular expressions. For example, to stop Firefox you can run:
pkill firefox
Partial matches also work:
pkill fire
To avoid accidental termination, first list matching processes with:
pgrep -l firefox
Using killall
killallkills all processes that share the same name. To close every Firefox instance:
killall firefox
It can also be used to restart desktop components, e.g.:
killall nautilus
Graphical Kill with xkill
Running xkill changes the cursor to a cross; clicking the misbehaving window immediately terminates its process. You can bind this command to a keyboard shortcut for quick access.
Conclusion
Instead of rebooting when an application hangs, the various kill commands let you safely terminate problematic processes, preventing system crashes and downtime—especially valuable on servers where a single rogue process could cause outages.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
