I think I have a shell script (launched by root's crontab) that's stuck in a loop. How do I list running scripts and how can I kill them?

I'm running Ubuntu 9.04, but I imagine it's similar for all *nix systems...

4 Answers 4


ps -ef will show you list of the currently running processes. Last field is the process name and parameters. Find the process you are looking for, and look at the 2nd column. 2nd column is process id or pid.

Then do kill -9 <pid> to kill that particular process.

  • So what's the 9 for? It seems to work without it....
    – Nick
    Apr 22, 2010 at 23:31
  • 4
    @Nick: Normally kill sends a SIGTERM to the process, allowing it to shut down appropriately. Adding -9 sends a SIGKILL instead, causing it to shut down forcibly without any chance of cleanup. See the signal(7) man page for some more details. Apr 22, 2010 at 23:35
  • It's an equivalent of "force". Meaning nothing could block the kill command.
    – solefald
    Apr 22, 2010 at 23:36
  • 2
    Except being in the middle of kernel code. Not even SIGKILL can interrupt that. Apr 22, 2010 at 23:39
  • 2
    That's what the power buttons for... ;)
    – Nick
    Apr 23, 2010 at 1:11

If you want a more stripped down version with better ASCII art (in my opinion I suppose) you can do

pstree -p

ps auxfwww will give you an ASCII art tree diagram of all the processes running on the system. From there it's just a matter of tracing down from the cron daemon and running kill against the appropriate PID.


Or just good old top command, which will show a toplist of most resource-hungry processes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.