For
example, if output appears from a backgrounded command during a vi session, simply press
Ctrl+L to redraw the screen to get rid of the output.
To avoid having the output appear, you should have any process running in the background
send its output to a file or to null.
Starting Background Processes
If you have programs that you want to run while you continue to work in the shell, you can place
the programs in the background. To place a program in the background at the time you run the
program, type an ampersand (&) at the end of the command line, like this:
$ find /usr > /tmp/allusrfiles &
This example command finds all files on your Linux system (starting from /usr), prints those filenames,
and puts those names in the file /tmp/allusrfiles. The ampersand (&) runs that command
line in the background. To check which commands you have running in the background,
use the jobs command, as follows:
$ jobs
[1] Stopped (tty output) vi /tmp/myfile
[2] Running find /usr -print > /tmp/allusrfiles &
[3] Running nroff -man /usr/man2/* >/tmp/man2 &
[4]- Running nroff -man /usr/man3/* >/tmp/man3 &
[5]+ Stopped nroff -man /usr/man4/* >/tmp/man4
The first job shows a text-editing command (vi) that I placed in the background and stopped by
pressing Ctrl+Z while I was editing.
Pages:
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217