mirror of
git://slackware.nl/current.git
synced 2024-12-27 09:59:16 +01:00
75a4a592e5
Mon Apr 25 13:37:00 UTC 2011 Slackware 13.37 x86_64 stable is released! Thanks to everyone who pitched in on this release: the Slackware team, the folks producing upstream code, and linuxquestions.org for providing a great forum for collaboration and testing. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. As always, thanks to the Slackware community for testing, suggestions, and feedback. :-) Have fun!
138 lines
4.8 KiB
HTML
138 lines
4.8 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>Foregrounding</title>
|
|
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
|
|
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
|
|
<link rel="UP" title="Process Control" href="process-control.html" />
|
|
<link rel="PREVIOUS" title="Process Control" href="process-control.html" />
|
|
<link rel="NEXT" title="ps" href="process-control-ps.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="SECT1" 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="process-control.html"
|
|
accesskey="P">Prev</a></td>
|
|
<td width="80%" align="center" valign="bottom">Chapter 11 Process Control</td>
|
|
<td width="10%" align="right" valign="bottom"><a href="process-control-ps.html"
|
|
accesskey="N">Next</a></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<hr align="LEFT" width="100%" />
|
|
</div>
|
|
|
|
<div class="SECT1">
|
|
<h1 class="SECT1"><a id="PROCESS-CONTROL-FOREGROUNDING"
|
|
name="PROCESS-CONTROL-FOREGROUNDING">11.2 Foregrounding</a></h1>
|
|
|
|
<p>If you need to interact with a backgrounded process, you can bring it back into the
|
|
foreground. If you've only got one backgrounded process, you can bring it back by
|
|
typing:</p>
|
|
|
|
<table border="0" bgcolor="#E0E0E0" width="100%">
|
|
<tr>
|
|
<td>
|
|
<pre class="SCREEN">
|
|
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">fg</kbd>
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>If the program is not done running, the program will take control over you terminal
|
|
and you will not be returned to a prompt. Sometimes, the program will finish running
|
|
while backgrounded. In this instance, you'll get a message like this:</p>
|
|
|
|
<table border="0" bgcolor="#E0E0E0" width="100%">
|
|
<tr>
|
|
<td>
|
|
<pre class="SCREEN">
|
|
[1]+ Done /bin/ls $LS_OPTIONS
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>That tells you that the backgrounded process (in this case <tt class="COMMAND">ls</tt>
|
|
- not terribly interesting) has completed.</p>
|
|
|
|
<p>It is possible to have several processes backgrounded at once. When this happens,
|
|
you'll need to know which process you want to bring back to the foreground. Just typing
|
|
<tt class="COMMAND">fg</tt> will foreground the process that was last backgrounded. What
|
|
if you had a whole list of processes in the background? Luckily, bash includes a command
|
|
to list all the processes. It's called <tt class="COMMAND">jobs</tt> and gives output
|
|
like so:</p>
|
|
|
|
<table border="0" bgcolor="#E0E0E0" width="100%">
|
|
<tr>
|
|
<td>
|
|
<pre class="SCREEN">
|
|
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">jobs</kbd>
|
|
[1] Stopped vim
|
|
[2]- Stopped amp
|
|
[3]+ Stopped man ps
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>This shows you a list of all the processes that are backgrounded. As you can see, they
|
|
are all stopped. This means that the processes are suspended. The number is a sort of ID
|
|
for all the backgrounded processes. The ID with a plus sign beside it (<var
|
|
class="LITERAL">man ps</var>) is the process that will be foregrounded if you just type
|
|
<tt class="COMMAND">fg</tt>.</p>
|
|
|
|
<p>If you wanted to foreground <tt class="COMMAND">vim</tt>, you would type:</p>
|
|
|
|
<table border="0" bgcolor="#E0E0E0" width="100%">
|
|
<tr>
|
|
<td>
|
|
<pre class="SCREEN">
|
|
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">fg 1</kbd>
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>and <tt class="COMMAND">vim</tt> would spring back up to the console. Backgrounding
|
|
processes can be very useful if you only have one terminal open over a dialup connection.
|
|
You can have several programs running on that one terminal, periodically switching back
|
|
and forth between them.</p>
|
|
</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="process-control.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-ps.html"
|
|
accesskey="N">Next</a></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="33%" align="left" valign="top">Process Control</td>
|
|
<td width="34%" align="center" valign="top"><a href="process-control.html"
|
|
accesskey="U">Up</a></td>
|
|
<td width="33%" align="right" valign="top"><tt class="COMMAND">ps</tt></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
|