Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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...

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer
kill -9? You're new, aren't you. – Ignacio Vazquez-Abrams Apr 22 '10 at 23:24
heh... i am more old school than new... – solefald Apr 22 '10 at 23:25
@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. – Ignacio Vazquez-Abrams Apr 22 '10 at 23:35
Except being in the middle of kernel code. Not even SIGKILL can interrupt that. – Ignacio Vazquez-Abrams Apr 22 '10 at 23:39
That's what the power buttons for... ;) – Nick Apr 23 '10 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
share|improve this answer
Cool, Thank you! – Nick Apr 23 '10 at 1:10

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.

share|improve this answer
Thanks- this way was easier in this case since I could follow the tree down from the cron daemon. – Nick Apr 22 '10 at 23:33

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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