theshell.ch/site/pages/cmd/basic/6-more-less.html

90 lines
3.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
layout: page
category-page: basic
category-title: Basic commands
tags: More and less
author: Marzio Lunghi
title: more and less
previous-page: pages/cmd/basic/5-open.html
next-page: pages/cmd/basic/7-clear.html
---
<p>
Both commands show the content of one or more files and its possible to do a research with
particular flags, but the “less” one allows us to go also backwards while reading the text
of a file.<br>
More is quite old, less is more recent and powerful.<br>
General syntax for both is:
</p>
<pre>
less [flags] path/name-file.*
more [flags] path/name-file.*
</pre>
<p>
The command <code>less</code> provides some useful commands to navigate and modify the file content.
Commands does not include flags, which are included under <i>Options</i>.
</p>
<h3>Commands</h3>
<p>
Such commands must be used once the file has been displayed.
They are not flags. For a single operation there can be multiple commands.
</p>
<ul>
<li><code>ENTER RETURN e ^E j ^N CR </code>:
Scroll forward N lines, 1 by default, if N is not specified.</li>
<li><code> y ^Y k ^K ^P </code>:
Scroll backward N lines , 1 by default , if N is not specified.</li>
<li><code> f ^F ^V SPACE </code>:
Scroll forward N lines, a window by default, if N is not specified.</li>
<li><code> b ^B ESC-v </code>
Scroll backward N lines, one window by default, if N is not specified.</li>
<li><code> ESC-SPACE </code>
Scroll forward one window like SPACE , but don't stop at end-of-file.</li>
<li><code>d ^D </code>
Scroll forward N lines, by default N correspond to half of the screen size.</li>
<li><code> u ^U </code>
Scroll Backward N lines, by default N correspond to half of the screen size.</li>
<li><code> ESC-) RightArrow </code>
Scroll horizontally right N characters, by default half of the screen size, if N is not specified.</li>
<li><code> ESC-( LeftArrow </code>
Scroll horizontally left N characters, by default half of the screen size, if N is not specified. </li>
</ul>
<h3>Jumping</h3>
<p>
Such commands must be used once the file has been displayed.
They are not. For a single operation there can be multiple commands. </p>
<ul>
<li><code> g &lt; ESC-&lt; </code>:
Go to line N, by default 1, if N is not specified.</li>
<li><code> G &gt; ESC-&gt; </code>:
Go to line N, by default the last one , if N is not specified.</li>
<li><code> t </code>:
Go to the (N-th) next tag. </li>
<li><code> T </code>
Go to the (N-th) previous tag.</li>
</ul>
<h3>Flags</h3>
Options may be given in one of two forms: either a single
character preceded by a "-", or a name preceded by "--" .
<ul>
<li><code> ? OR --help </code>
Display help guide with the description of commands and more , it is sufficient to enter less -? .</li>
<li><code> -c OR --clear-screen </code>
Repaint by clearing rather than scrolling.</li>
<li><code> -e -E OR --quit-at-eof --QUIT-AT-EOF </code>
Quit the file, when you scroll to the end of the file.</li>
<li><code> -~ OR --tilde </code>
Do not display tildes after end of file. </li>
</ul>