summaryrefslogtreecommitdiff
path: root/slackbook/html/process-control.html
blob: 8727262d22f015174ee0f25ea830c927f4b68a73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Process Control</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="PREVIOUS" title="Aliasing files with ln" href="file-commands-link.html" />
<link rel="NEXT" title="Foregrounding" href="process-control-foregrounding.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="CHAPTER" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>

<tr>
<td width="10%" align="left" valign="bottom"><a href="file-commands-link.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom"></td>
<td width="10%" align="right" valign="bottom"><a
href="process-control-foregrounding.html" accesskey="N">Next</a></td>
</tr>
</table>

<hr align="LEFT" width="100%" />
</div>

<div class="CHAPTER">
<h1><a id="PROCESS-CONTROL" name="PROCESS-CONTROL"></a>Chapter 11 Process Control</h1>

<div class="TOC">
<dl>
<dt><b>Table of Contents</b></dt>

<dt>11.1 <a
href="process-control.html#PROCESS-CONTROL-BACKGROUNDING">Backgrounding</a></dt>

<dt>11.2 <a href="process-control-foregrounding.html">Foregrounding</a></dt>

<dt>11.3 <a href="process-control-ps.html"><tt class="COMMAND">ps</tt></a></dt>

<dt>11.4 <a href="process-control-kill.html"><tt class="COMMAND">kill</tt></a></dt>

<dt>11.5 <a href="process-control-top.html"><tt class="COMMAND">top</tt></a></dt>
</dl>
</div>

<p>Every program that is running is called a process. These processes range from things
like the X Window System to system programs (daemons) that are started when the computer
boots. Every process runs as a particular user. Processes that are started at boot time
usually run as <tt class="USERNAME">root</tt> or <tt class="USERNAME">nobody</tt>.
Processes that you start will run as you. Processes started as other users will run as
those users.</p>

<p>You have control over all the processes that you start. Additionally, <tt
class="USERNAME">root</tt> has control over all processes on the system, including those
started by other users. Processes can be controlled and monitored through several
programs, as well as some shell commands.</p>

<div class="SECT1">
<h1 class="SECT1"><a id="PROCESS-CONTROL-BACKGROUNDING"
name="PROCESS-CONTROL-BACKGROUNDING">11.1 Backgrounding</a></h1>

<p>Programs started from the command line start up in the foreground. This allows you to
see all the output of the program and interact with it. However, there are several
occasions when you'd like the program to run without taking up your terminal. This is
called running the program in the background, and there are a few ways to do it.</p>

<p>The first way to background a process is by adding an ampersand to the command line
when you start the program. For example, assume you wanted to use the command line mp3
player <tt class="COMMAND">amp</tt> to play a directory full of mp3s, but you needed to
do something else on the same terminal. The following command line would start up amp in
the background:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">amp *.mp3 &#38;</kbd>
</pre>
</td>
</tr>
</table>

<p>The program will run as normal, and you are returned to a prompt.</p>

<p>The other way to background a process is to do so while it is running. First, start up
a program. While it is running, hit <b class="KEYCAP">Control</b>+<b
class="KEYCAP">z</b>. This suspends the process. A suspended process is basically paused.
It momentarily stops running, but can be started up again at any time. Once you have
suspended a process, you are returned to a prompt. You can background the process by
typing:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">bg</kbd>
</pre>
</td>
</tr>
</table>

<p>Now the suspended process is running in the background.</p>
</div>
</div>

<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="file-commands-link.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="process-control-foregrounding.html"
accesskey="N">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">Aliasing files with <tt
class="COMMAND">ln</tt></td>
<td width="34%" align="center" valign="top">&nbsp;</td>
<td width="33%" align="right" valign="top">Foregrounding</td>
</tr>
</table>
</div>
</body>
</html>