From 58b6f588310f5361b43548f76c7ffff041d26b79 Mon Sep 17 00:00:00 2001 From: Alan Hicks Date: Sat, 1 May 2010 16:56:25 -0400 Subject: Added jobs, fg, and bg in a "Task Management" section. --- chapter_05.xml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/chapter_05.xml b/chapter_05.xml index 2c937c7..2241c22 100644 --- a/chapter_05.xml +++ b/chapter_05.xml @@ -283,6 +283,48 @@ root 3202 0.0 0.0 1660 536 tty6 Ss+ Feb15 0:00 /sbin/agetty 38 +
+Task Management + + +bash has yet another cool feature to offer, +the ability to suspend and resume tasks. This allows you to +temporarily halt a running process, perform some other task, then +resume it or optionally make it run in the background. Upon pressing +CTRL-Z, bash will suspend +the running process and return you to a prompt. You can return to that +process later. Additionally, you can suspend multiple processes in +this way indefinitely. The jobs built-in +command will display a list of suspended tasks. + + +darkstar:~$ jobs +[1]- Stopped vi TODO +[2]+ Stopped vi chapter_05.xml + + + +In order to return to a suspended task, run the +fg built-in to bring the the most recently +suspended task back into the fore ground. If you have mutiple suspended +tasks, you can specify a number as well to bring one of them to the +foreground. + + +darkstar:~$ fg # "vi TODO" +darkstar:~$ fg 1 # "vi chapter_05.xml" + + + +You can also background a task with (surprize) +bg. This will allow the process to continue +running without maintaining control of your shell. You can bring it +back to the fore ground with fg in the same +way as suspended tasks. + + +
+
Terminals -- cgit v1.2.3