Job control (Unix): Difference between revisions

Content deleted Content added
Overview: erroneous, $! contains pid and not the job number
Overview: rephrase
Line 4:
 
==Overview==
When using [[Unix]] or [[Unix-like]] operating systems via a [[Computer terminal|terminal]] (or [[terminal emulator]]), a user will initially only have a single process running, their interactive [[Unix shell|shell]] (it may or may not be a [[logging (computer security)|login]] shell or may be not). Most tasks{{efn|Here "task" is a non-technical term for "some activity", while "process" and "job" are technical terms.}} (directory listing, editing files, etc.) can easily be accomplished by letting the program take control of the terminal and returning control to the shell when the program exits – formally, by attaching to [[standard streams|standard input and standard output]] to the shell, which reads or writes from the terminal, and catching signals sent from the keyboard, like the termination signal resulting from pressing {{keypress|Control|C}}.
 
However, sometimes the user will wish to carry out a task while using the terminal for another purpose. A task that is running but is not receiving input from the terminal is said to be running "in the background", while the single task that is receiving input from the terminal is "in the foreground". Job control is a facility developed to make this possible, by allowing the user to start processes in the background, send already running processes into the background, bring [[background process]]es into the foreground, and suspend or terminate processes.