Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

How to Find and Kill Unresponsive Processes in Linux

Published

LinuxLinux and Commands

If you’ve used Linux for any length of time, you’ve probably experienced a stubborn app that just won’t quit. Maybe a browser tab goes haywire, a backup script eats all your memory, or a desktop program freezes, refusing to close no matter how many times you click the “X.” When this happens, it’s more than an annoyance—it can drain your resources, slow down the system, and sometimes even cause bigger problems.

Fortunately, Linux provides several ways to take back control when things go wrong. You don’t have to reboot or power-cycle your machine every time a process gets stuck. With a handful of commands and some know-how, you can locate unresponsive processes, understand what’s happening, and force programs to close safely when nothing else works.

This guide isn’t just a list of commands. You’ll learn why processes get stuck, how to identify them quickly, and how to safely kill only what you need—without accidentally shutting down important system services. By the end, you’ll feel much more confident handling frozen apps and runaway tasks, whether you’re using a server, a desktop, or a remote SSH terminal.

Table of Contents

  1. What is a Process in Linux?
  2. Why Do Processes Become Unresponsive?
  3. How to Check Which Processes Are Running
  4. How to Find the Process ID (PID)
  5. How to Kill a Process in Linux
  6. Understanding Linux Kill Signals (SIGTERM, SIGKILL, and More)
  7. What to Do if a Process Won’t Die
  8. Best Practices for Killing Processes
  9. Step-by-Step Examples (Real-World Scenarios)
  10. Troubleshooting and Advanced Tips
  11. Frequently Asked Questions (FAQ)
  12. Conclusion

1. What is a Process in Linux?

A process is simply a running instance of any program or command. The moment you launch an app—whether it’s your web browser, a code editor, or a background script—Linux creates a process for it. Each process is assigned a unique number, called its Process ID or PID.

Processes can spawn other processes (their “children”), run in the background or foreground, and use system resources like CPU and memory. Understanding how to check and manage processes is a basic but critical Linux skill.

2. Why Do Processes Become Unresponsive?

Even on the most stable systems, things can go wrong. Here are some common reasons processes hang or become unresponsive:

  • Software bugs: A programming error causes a loop or crash.
  • Resource exhaustion: The process runs out of memory or can’t access needed files.
  • Lost hardware or missing devices: A process is waiting for a network share, printer, or USB device that’s no longer available.
  • Deadlocks and race conditions: Two or more processes wait for each other in a never-ending cycle.
  • Zombie or defunct processes: The process has ended but wasn’t cleaned up by its parent.
  • Blocked on input/output: The process is stuck waiting for data from the disk or network.
  • User error: Started the wrong script or launched too many processes accidentally.

When any of these happen, the process may stop responding to input, use up all your CPU, or freeze the system interface.

3. How to Check Which Processes Are Running

Before you can kill (or even diagnose) a problem process, you need to see what’s running. Linux offers both terminal and GUI options.

Using Terminal Commands

The ps Command

This command lists processes. Try:

ps aux

This shows all processes for all users, with columns for the user, PID, CPU/memory usage, and command line.

The top Command

This provides a live, updating view:

top

Lists all running processes, with most active at the top. Shows CPU, memory, and process state. Refreshes automatically.

The htop Command

If you want a friendlier interface, install htop:

sudo apt install htop    # Ubuntu/Debian
sudo dnf install htop    # Fedora/CentOS

Then run:

htop

You get colored bars and easy interactive controls—useful for spotting resource hogs fast.

The pgrep and pidof Commands

If you know the process name:

pgrep firefox

or

pidof firefox

Both return the PID(s) for Firefox (replace with your program’s name).

Using Graphical Tools

Most Linux desktops include a GUI task manager.

  • GNOME: Open “System Monitor” from your applications menu.
  • KDE: Use “System Monitor” or “KSysGuard.”
  • XFCE: Try “Task Manager.”

These tools let you view, search, and sort processes by name, resource use, or status. You can often right-click to end or kill a process directly.

4. Signs That a Process Is Stuck or Unresponsive

How do you know which process is causing trouble? Watch for these clues:

  • Application window is grayed out and won’t respond to clicks or keystrokes.
  • Terminal command doesn’t finish or hangs forever.
  • System feels slow, fan spins up, or other apps lag.
  • In top or htop, you see a process using 100% CPU or enormous memory.
  • The process status (in ps aux or top) shows:
    • D (uninterruptible sleep, usually waiting on I/O)
    • Z (zombie/defunct, process is dead but not cleaned up)
    • T (stopped, usually by a signal)

5. How to Find the Process ID (PID)

Every process has a unique PID. You need it to kill the process from the terminal.

Find the PID by process name:

ps aux | grep firefox

Look for the number in the second column.

Or, more directly:

pgrep firefox

You’ll get the PID(s) for all matching processes.

In top or htop:

The PID is listed in the first column. Use arrows in htop to select, or remember the number for top.

In a GUI task manager:

Usually there’s a column labeled “PID.”

6. How to Kill a Process in Linux

When you’ve found the PID, you can try several tools to stop (or “kill”) the process.

The kill Command

This sends a signal to the process.

Basic Usage:

kill PID

For example, to kill PID 12345:

kill 12345

This sends SIGTERM (signal 15), which politely asks the process to close. If the process refuses to die, use SIGKILL:

kill -9 12345

Using killall and pkill (by Name)

If you want to kill all processes with a specific name:

killall firefox

Or, to be forceful:

killall -9 firefox

Using pkill (Pattern Matching)

You can match part of the process name:

pkill -f myscript.py

Using xkill for Graphical Windows

If a GUI program won’t close:

Enter:

xkill

The cursor changes to a cross or skull. Click the unresponsive window to force it to close.

Killing from top and htop

In top:

  • Press k
  • Enter the PID
  • Press Enter

In htop:

  • Use arrows to select the process
  • Press F9 (kill)
  • Choose the signal (default is SIGTERM, usually works)

7. Understanding Linux Kill Signals

  • SIGTERM (15): The default. Politely asks the process to exit. Lets the program clean up.
  • SIGKILL (9): Forces immediate termination. The process cannot ignore this and is killed instantly—no saving work.
  • SIGSTOP/SIGCONT: Pause and resume a process (like “freezing” it).
  • SIGINT (2): Similar to pressing Ctrl+C in a terminal.

Rule of thumb: Always try to use SIGTERM before SIGKILL. Only use SIGKILL if the process refuses to close.

8. What to Do if a Process Won’t Die

Sometimes, even SIGKILL doesn’t work. Why? The process might be stuck in “uninterruptible sleep” (status “D”)—often waiting for hardware or a slow disk, or a deeper kernel/hardware problem.

What you can try:

  • Wait a few minutes in case the process is just slow.
  • Try pausing/resuming with SIGSTOP and SIGCONT:
    kill -STOP PID
    kill -CONT PID
  • Try switching to a different terminal (Ctrl+Alt+F3), logging in, and repeating the kill commands.
  • Check logs for hardware or system errors (dmesg, /var/log/syslog).
  • If nothing works: A full system reboot may be necessary to clear the process.

9. Best Practices for Killing Processes

  • Close apps normally first: Use the application’s Quit or Exit menu.
  • Don’t kill system processes unless you know what you’re doing: Killing the wrong process can crash your desktop or server.
  • Use the least aggressive signal possible: Start with SIGTERM.
  • Be cautious with killall or pkill: They can kill multiple processes if you’re not specific.
  • Check process ownership: To kill processes started by other users, you’ll need root privileges (sudo kill PID).

10. Step-by-Step Examples (Real-World Scenarios)

Example 1: Killing a Frozen Web Browser

You notice Firefox is unresponsive.

pgrep firefox

Returns, say, 2345.
Try:

kill 2345

Wait a few seconds. If still stuck:

kill -9 2345

Example 2: Killing an Unresponsive Background Script

Your backup script isn’t finishing. Find it:

ps aux | grep backup.sh

See PID 3789.
Kill it:

kill 3789

If it won’t die:

kill -9 3789

Example 3: Using xkill for a Stuck Window

App window won’t close.

Open a terminal, run:

xkill

Click the window.

Example 4: Using htop to Monitor and Kill

Open htop in the terminal:

htop

Use arrow keys to select the process.
Press F9, then Enter to kill.

11. Troubleshooting and Advanced Tips

Zombie Processes

These are marked with “Z.” They’re already dead but waiting for their parent process to acknowledge them. Usually, you don’t need to kill these—fix the parent process or reboot.

Processes in “D” State

These can’t be killed until their hardware operation finishes.

Stuck File Systems

If your process is waiting on a network or external disk, fixing the mount may allow it to die.

Recurring Issues

If the same process always freezes, check for updates, review logs, or consider alternative software.

12. Frequently Asked Questions (FAQ)

  • Q: Can I accidentally crash my system using kill?
    A: If you kill critical system or desktop processes, you can cause a crash or logout. Avoid killing anything owned by root unless you’re sure.
  • Q: What’s the difference between kill, pkill, and killall?
    A: kill uses a PID, pkill uses a pattern, and killall uses the exact process name.
  • Q: Why does kill sometimes not work, even with -9?
    A: The process may be stuck in uninterruptible sleep, usually waiting for hardware. Only a reboot can clear it.
  • Q: How do I avoid killing the wrong process?
    A: Double-check the PID with ps or pgrep, and always review what each process does before killing.
  • Q: Do I need to sudo to kill a process?
    A: Only if the process is owned by another user or root.

13. Conclusion

Finding and killing unresponsive processes is a must-have skill for anyone using Linux, from everyday desktop users to seasoned system administrators. With the right commands—ps, top, kill, killall, pkill, and graphical tools—you can quickly regain control of your system when things go wrong.

Next time an application freezes or a background process goes rogue, you’ll know exactly how to track it down, terminate it, and keep your Linux system running smoothly. Remember to use kill signals wisely, monitor for recurring issues, and always save your work before killing resource-hungry apps.

If you want to go deeper, explore advanced tools like strace, lsof, or system monitoring dashboards, and keep learning—Linux is full of powerful ways to keep your system healthy and productive.

Related guides

Account services are unavailable until the production backend is configured.