Finding and Stopping Runaway Programs

At any moment, there's a lot going on with your computer. Programs and processes are controlling hard drive access, determining what you see on the screen, managing what is written to event logs, and watching for input from you. If you've ever looked at the Task Manager on Windows 2000 or XP (press Ctrl-Alt-Del and click Task Manager to bring it up), you've seen a lot of programs running that you probably couldn't identify.

Sometimes programs crash or become unresponsive. I wish I could say that Linux was immune to problems like this, but it isn't. When a problem occurs, the affected program process may get hung up, and hang around, using up a lot of your computer's time and memory and slowing other programs down. You need to know how to find runaway program processes like this and force them to stop.

There are several ways to view running processes in Linux. One of the most popular is the top program. Here is the output from my laptop:

dbrick@rivendell $: top top - 19:46:56 up 1 day, Chapter 8:18, Chapter 1 user, load average: 0.02, 0.06, 0.05 Tasks: 48 total, Chapter 1 running, 47 sleeping, 0 stopped, 0 zombie Cpu(s): Chapter 2.5% user, Chapter 1.1% system, 0.9% nice, 95.5% idle Mem: 514756k total, 491716k used, 23040k free, 101568k buffers Swap: 521632k total, 196k used, 521436k free, 178524k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2013 root 14 0 70524 24m 2296 S 2.0 4.8 14:21.21 X 25020 dbrick 11 0 924 924 736 R 2.0 ...

Get Test Driving Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.