How to Kill a Frozen Process in Ubuntu

The Rogue Execution Vector

When operating a headless Ubuntu server, a poorly written python script or a memory-leaking database query can enter an infinite loop. This rogue process will aggressively consume 100% of the CPU cycles, starving all other legitimate applications and effectively bringing the server to a standstill. Because you cannot simply click a red “X” to close the program, you must use the command line to identify the exact numerical ID of the rogue software and instruct the Linux kernel to execute a targeted, forceful termination.

How to Kill a Frozen Process

You must combine two distinct utilities: one to identify the process ID (PID), and another to send the termination signal.

1. Open your terminal application or connect to your server via SSH.
2. Identify the Target (The `top` command): First, you must find the rogue application’s unique ID.
* Type top and press Enter.
* The terminal will display a live list of the most resource-intensive programs. Look at the very top of the list.
* Identify the name of the frozen application in the far-right `COMMAND` column (e.g., `mysqld` or `python3`).
* Look at the far-left column for that exact row. You will see a number under the PID heading (e.g., `4052`). This is the critical target coordinate. Memorize it.
* Press Q to quit the `top` monitor and return to the prompt.
3. Execute the Termination (The `kill` command): Now that you have the PID, you must order the kernel to destroy it. Execute the following command, replacing `4052` with your actual PID:

kill -9 4052

4. Command Breakdown:
* kill: The utility used to send signals to processes.
* -9 (SIGKILL): This is the absolute force command. It bypasses the application entirely and orders the kernel to instantly severe all memory and CPU allocation, destroying the process immediately without waiting for it to save data.
* 4052: The target PID.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.