Sunday, July 23, 2006

Managing Foreground and Background Jobs and Processes [32-40]

Unix system administrators often need to switch and move jobs from foreground to background and vice versa.
[32] To stop (not kill) a currently running job and return to shell, you can use Ctrl-z.
[33] Then to view the stopped jobs during the current session
jobs
[34] To kill a stopped job number 2
kill -9 %2
[35] Check the status of processes in all sessions running by user frankly
ps -u frankly
[36] Kill a process by its process id (822)
kill -9 822
[37] Bring the job that was sent most recently sent to run in background to foreground
fg
[38] Bring the background job with job id 2 to run in the foreground
fg %2
[39] Start running the most recently stopped job in the background
bg
[40] Run a job in the background
Add & to end of the command