Originally posted by skrishnaswamy
If you do an fg you can bring the process to the foreground.
if you do a bg you can put it to the background.
# somescript &
# kill %1
will kill that process.
That's a good way to kill one process, but if there's multiple background jobs, some of which you don't want to kill, it'll not work.
The shell should have a 'jobs' command which lists all the commands running in the background for this instance of the shell, rather than the machine's whole process table. You can munge that output and kill the relevant ones:
for i in `jobs | grep my-db-stress-script | sed -e 's/\].*$//' -e 's/^.*\[//'`; do eval kill %$i; done
For killing a particular process, "kill <pid>" works as in most *nix.
"kill -9" is too aggresive a command to remove a process and all it's children, it kills the process immediately. "man kill" or "man signal" should give you more info on the severity of signals.
hmmm....on linux you could also use the pstree -p <username> command to find your bg process ,pipe them to a sed and kill em. In that way you wont miss the child pids forked by your background processes and would not reult in Zombie processes.