slackware-current/slackbook/html/file-commands-pagers.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
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!
2018-05-31 22:45:18 +02:00

144 lines
5.7 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>Pagers: more, less, and most</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="Handling Files and Directories" href="file-commands.html" />
<link rel="PREVIOUS" title="Handling Files and Directories" href="file-commands.html" />
<link rel="NEXT" title="Simple Output: cat and echo" href="file-commands-output.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="file-commands.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 10 Handling Files and
Directories</td>
<td width="10%" align="right" valign="bottom"><a href="file-commands-output.html"
accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%" />
</div>
<div class="SECT1">
<h1 class="SECT1"><a id="FILE-COMMANDS-PAGERS" name="FILE-COMMANDS-PAGERS">10.2 Pagers:
<tt class="COMMAND">more</tt>, <tt class="COMMAND">less</tt>, and <tt
class="COMMAND">most</tt></a></h1>
<div class="SECT2">
<h2 class="SECT2"><a id="AEN3491" name="AEN3491">10.2.1 <tt
class="COMMAND">more</tt></a></h2>
<p><tt class="COMMAND">more</tt>(1) is what we call a pager utility. Oftentimes the
output of a particular command is too big to fit on one screen. The individual commands
do not know how to fit their output to separate screens. They leave this job to the pager
utility.</p>
<p>The <tt class="COMMAND">more</tt> command breaks the output into individual screens
and waits for you to press the space bar before continuing on to the next screen.
Pressing the enter key will advance the output one line. Here is a good example:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">cd /usr/bin</kbd>
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l</kbd>
</pre>
</td>
</tr>
</table>
<p>That should scroll for a while. To break up the output screen by screen, just pipe it
through more:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">%</samp> <kbd class="USERINPUT">ls -l | more</kbd>
</pre>
</td>
</tr>
</table>
<p>That is the pipe character (shift backslash). The pipe is short for saying take the
output of <tt class="COMMAND">ls</tt> and feed it into <tt class="COMMAND">more</tt>. You
can pipe just about anything through the <tt class="COMMAND">more</tt> command, not just
<tt class="COMMAND">ls</tt>. Piping is also covered in <a
href="shell-command-line.html#SHELL-COMMAND-LINE-PIPING">Section 8.2.3</a>.</p>
</div>
<div class="SECT2">
<h2 class="SECT2"><a id="AEN3518" name="AEN3518">10.2.2 <tt
class="COMMAND">less</tt></a></h2>
<p>The <tt class="COMMAND">more</tt> command is quite handy, but often you will find that
you have advanced past the screen you wanted. more does not provide a way to go back. The
<tt class="COMMAND">less</tt>(1) command provides this functionality. It is used in the
same way as the <tt class="COMMAND">more</tt> command, so the previous examples apply
here too. So, <tt class="COMMAND">less</tt> is more than <tt class="COMMAND">more</tt>.
Joost Kremers puts it this way:</p>
<a id="AEN3530" name="AEN3530"></a>
<blockquote class="BLOCKQUOTE">
<p><tt class="COMMAND">less</tt> is more, but more <tt class="COMMAND">more</tt> than <tt
class="COMMAND">more</tt> is, so <tt class="COMMAND">more</tt> is less <tt
class="COMMAND">less</tt>, so use more <tt class="COMMAND">less</tt> if you want less <tt
class="COMMAND">more</tt>.</p>
</blockquote>
</div>
<div class="SECT2">
<h2 class="SECT2"><a id="AEN3539" name="AEN3539">10.2.3 <tt
class="COMMAND">most</tt></a></h2>
<p>Where <tt class="COMMAND">more</tt> and <tt class="COMMAND">less</tt> leave off, <tt
class="COMMAND">most</tt>(1) picks back up. If <tt class="COMMAND">less</tt> is more than
<tt class="COMMAND">more</tt>, <tt class="COMMAND">most</tt> is more than <tt
class="COMMAND">less</tt>. Whereas the other pagers can only display one file at a time,
<tt class="COMMAND">most</tt> is capable of viewing any number of files, as long as each
file's window is at least 2 lines long. <tt class="COMMAND">most</tt> has a lot of
options, check the man page for full details.</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.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="file-commands-output.html"
accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Handling Files and Directories</td>
<td width="34%" align="center" valign="top"><a href="file-commands.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Simple Output: <tt class="COMMAND">cat</tt>
and <tt class="COMMAND">echo</tt></td>
</tr>
</table>
</div>
</body>
</html>