Thursday, December 28, 2006

Job Control

View the currently running jobs:
jobs

Place running foreground process into background:

ctl-z #puts the job to sleep
bg %1

Bring a background job into the foreground:
fg %1

Kill a job:
kill %1
kill %1 -9

Find the PID of all jobs
jobs -p
jobs -pl

Bring a nohuped process to the foreground
# note: I think you can only do this from the same terminal session.
# It doesn't look like it is possible to nohup a process, close a terminal
# and then bring the process back to the foreground again. Use screen instead.

# If you do not close your terminal session and if you do something like
nohup sleep 100 &
# and want to bring this to the foreground
# find the process ID using
jobs -p
or
ps -ef
# then supply the PID as the argument to the fg command
fg 14389420


http://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics
http://www.uwyo.edu/askit/displaydoc.asp?askitdocid=262&parentid=1
http://linuxhelp.blogspot.com/2005/05/job-control-in-linux.html#axzz0gU42IqoP

No comments: