How to Kill a Process from the Terminal in Unix/Linux?
Posted by Admin on February 13, 2026
In the world of Unix/Linux systems, managing processes is an essential part of maintaining system performance. One of the most common tasks system administrators and developers face is terminating a process that is no longer responding or is consuming too many system resources. In this blog, we will guide you through the steps to kill a process from the terminal in Unix/Linux, as well as explain the different options and commands you can use.
Understanding Processes in Unix/Linux
Before diving into the commands, let’s first understand what a process is. A process in Unix/Linux is an instance of a program that is being executed. Each process has a unique Process ID (PID) that identifies it. Sometimes, processes can misbehave or become unresponsive, and killing them becomes necessary to free up system resources.
Step by Step Guide to Kill a Process
1. List Running Processes
The first thing you need to do is find the process you want to kill. You can list all the processes currently running on your system using the ps command.
bash
CopyEdit
ps aux
This will show you a list of all processes, their PIDs, and other information like CPU and memory usage. If you're looking for a specific process, you can filter the list using grep:
bash
CopyEdit
ps aux | grep
Replace with the name of the application or service you're looking for.
2. Find the Process ID (PID)
Once you have the list of processes, locate the PID of the process you want to kill. The PID is usually the second column in the ps output.
3. Kill the Process
Now that you have the PID, you can use the kill command to terminate the process.
bash
CopyEdit
kill
Replace with the actual Process ID of the application you want to terminate. In most cases, this will gracefully stop the process.
4. Force Kill a Process
If the process does not terminate with the kill command, you may need to force it to stop. Use the kill 9 command, which sends a SIGKILL signal to the process, forcing it to terminate immediately.
bash
CopyEdit
kill 9
Note:
Be cautious when using kill 9 because it does not allow the process to clean up resources, and it may cause unintended consequences, like data loss.
5. Use top or htop for Interactive Killing
If you prefer a more interactive approach, you can use the top or htop command. These commands show the processes in real time, and you can use the interface to select and kill a process.
Using top:
bash
CopyEdit
top
Once in top, press k to kill a process, then enter the PID of the process you want to terminate.
Using htop:
If you have htop installed, it provides a more user friendly interface. You can simply select the process, press F9 to kill it, and choose the signal type (default is SIGTERM).
Conclusion
Killing a process from the terminal in Unix/Linux is a straightforward task if you know the right commands and approach. By using commands like ps, kill, top, and htop, you can efficiently manage and terminate processes that are misbehaving or consuming too many resources. Always ensure that you’re cautious when using forceful methods like kill 9, as they don’t allow processes to clean up after themselves.
At DirectDeals, we believe in simplifying complex tasks, which is why we strive to provide reliable and user friendly solutions. With over 26 years of trust, DirectDeals ensures that
Need help choosing or buying? Contact us today!
Phone: 1-800-983-2471
Email: sales@directdeals.com
Website: www.directdeals.com
Let DirectDeals make software simple—for you, your family, and your business.