Книга: Fedora™ Unleashed, 2008 edition

Background Processing

Background Processing

The shell enables you to start a command and then launch it into the background as a process by using an ampersand (&) at the end of a command line. This technique is often used at the command line of an X terminal window to start a client and return to the command line. For example, to launch another terminal window using the xterm client,

$ xterm &
[3] 1437

The numbers echoed back show a number (3 in this example), which is a job number, or reference number for a shell process, and a Process ID number, or PID (1437 in this example). You can kill the xterm window session by using the shell's built-in kill command, along with the job number like this:

$ kill %3

Or the process can be killed with the kill command, along with the PID, like so:

$ kill 1437

Background processing can be used in shell scripts to start commands that take a long time, such as backups:

# tar -czf /backup/home.tgz /home &

Related Fedora and Linux Commands

You can use these commands and tools when using the shell or writing shell scripts:

chsh — Command used to change one's login shell

kibitz — Allows two-person interaction with a single shell

mc — A visual shell named the GNU Midnight Commander

nano — An easy-to-use text editor for the console

system-config-users — A graphical user-management utility that can be used to change one or more user login shells

shar — Command used to create shell archives

vi — The vi (actually vim) text editor

Оглавление книги


Генерация: 1.708. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз