#Jobs in Bash.html
{@begin=sh@
# this operation takes a considerably long time to finish
$ find / -iname '*a*' &> files_with_a_in_their_names.list
# long long thinking
$
# however, by running it in the background,
# we don't have to wait before we can run another command from the same shell
$ find / -iname '*a*' &> files_with_a_in_their_names.list &
$
# moving a job from the background to the foreground
# start a few jobs so we have a few options to choose from
$ find / -iname '*a*' &> files_with_a_in_their_names.list &
$ find / -iname '*b*' &> files_with_b_in_their_names.list &
$ find / -iname '*c*' &> files_with_c_in_their_names.list &
$ find / -iname '*d*' &> files_with_d_in_their_names.list &
[1] 17156
[2] 17157
[3] 17158
[4] 17159
# listing the background jobs because in this example
# I'm a goldfish with a very small terminal
$ jobs
[1] Running find / -iname '*a*' &> files_with_a_in_their_names.list &
[2] Running find / -iname '*b*' &> files_with_b_in_their_names.list &
[3]- Running find / -iname '*c*' &> files_with_c_in_their_names.list &
[4]+ Running find / -iname '*d*' &> files_with_d_in_their_names.list &
# bring the 3th one into the foreground
$ fg %3
# moving a job from the foreground to the background
# start in the foreground
$ find / -iname '*a*' &> files_with_a_in_their_names.list
# stopping it explicitly
# Yellow( Ctrl+z ) key combination hit
^Z
[1]+ Stopped find / -iname '*a*' > files_with_a_in_their_names.list
# resume in the background
$ bg %1
@end=sh@}