slackware-current/slackbook/html/process-control.html
Patrick J Volkerding 5a12e7c134 Slackware 13.0
Wed Aug 26 10:00:38 CDT 2009
Slackware 13.0 x86_64 is released as stable!  Thanks to everyone who
helped make this release possible -- see the RELEASE_NOTES for the
credits.  The ISOs are off to the replicator.  This time it will be a
6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD.
We're taking pre-orders now at store.slackware.com.  Please consider
picking up a copy to help support the project.  Once again, thanks to
the entire Slackware community for all the help testing and fixing
things and offering suggestions during this development cycle.
As always, have fun and enjoy!  -P.
2018-05-31 22:41:17 +02:00

138 lines
5.1 KiB
HTML

<!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>