Читать книгу Linux Bible - Christopher Negus - Страница 185

CAUTION

Оглавление

Before you put a text processor, word processor, or similar program in the background, make sure that you save your file. It's easy to forget that you have a program in the background, and you will lose your data if you log out or the computer reboots.

To refer to a background job (to cancel or bring it to the foreground), use a percent sign (%) followed by the job number. You can also use the following to refer to a background job:

% Refers to the most recent command put into the background (indicated by the plus sign when you type the jobs command). This action brings the command to the foreground.
%string Refers to a job where the command begins with a particular string of characters. The string must be unambiguous. (In other words, typing %vi when there are two vi commands in the background results in an error message.)
%?string Refers to a job where the command line contains a string at any point. The string must be unambiguous or the match fails.
%-- Refers to the job stopped before the one most recently stopped.

If a command is stopped, you can start it running again in the background using the bg command. For example, refer back to job 5 from the jobs list in a previous example:

 [5]+ Stopped nroff -man /usr/man4/*>/tmp/man4

Enter the following:

 $ bg %5

After that, the job runs in the background. Its jobs entry appears as follows:

 [5] Running nroff -man /usr/man4/*>/tmp/man4 &

Linux Bible

Подняться наверх