Just like Windows and macOS, Linux applications can occasionally freeze, crash, or become unresponsive. When a program locks up and refuses to close normally, you don’t need to restart your entire computer. Instead, you can use the terminal to identify the rogue process and force it to terminate using the kill command.
Step 1: Find the Process ID (PID)
Before you can kill an unresponsive program, you need to know its official system name or its Process ID (PID). Every running program is assigned a unique PID.
Open your terminal and use the top command to see a live, updating list of all running processes, sorted by CPU usage:
top
If you already know the name of the frozen application (for example, Firefox), you can search for it directly using the pgrep (process grep) command:
pgrep firefox
The terminal will output a number, such as 4312. This is your target PID.
Step 2: Kill the Process Gracefully
Once you have the PID, you can send a termination signal. It is always best practice to ask the program to shut down gracefully first, allowing it to save data and clear its memory caches.
kill 4312
This command sends a standard SIGTERM (Signal 15) request. Wait a few seconds to see if the application closes.
Step 3: Force Kill the Process (The Last Resort)
If the program is completely frozen and ignores the standard kill command, you must force it to shut down immediately. You do this by sending a SIGKILL (Signal 9).
kill -9 4312
Warning: Using kill -9 does not give the program a chance to save your work. It terminates the process instantaneously at the kernel level.
The Faster Method: killall
If you don’t want to bother looking up the PID, and you are absolutely certain of the application’s exact name, you can use the killall command. This will terminate all instances of that program at once.
killall firefox
Like the standard kill command, you can force it if necessary:
killall -9 firefox
Conclusion
Learning how to manage system processes via the terminal gives you absolute control over your Linux machine. Whether you use pgrep and kill -9 or stick to the simpler killall, you will never have to reboot your computer just because one application decided to freeze.