theshell.ch/site/pages/cmd/basic/More:less.html

94 lines
3.4 KiB
HTML
Raw Normal View History

---
layout: page
category_title: Basic commands
category-page: basic
tags: More and less
author: Marzio Lunghi
title: More and Less
<!--next-page: pages/cmd/basic/ --> <!-- The sequence must be defined -->
---
<h2> More and Less </h2>
<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.
More is quite old, less is more recent and powerful.
<br>
General syntax for both is:
<br>
<pre>
Device-name:Current-position username$ less [flags] path/name-file.*
<br>
Device-name:Current-position username$ more [flags] path/name-file.*
</pre>
Less provides some useful commands to navigate and modify the file content.
Commands does not include flags, which are included under Options.
</p>
<h3> Commands and flags </h3>
<h4> MOVING </h4>
<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>
<ol>
<li> <code>ENTER RETURN e ^E j ^N CR </code></li>
<p> Scroll forward N lines, 1 by default, if N is not specified. </p>
<li> <code> y ^Y k ^K ^P </code></li>
<p> Scroll backward N lines , 1 by default , if N is not specified. </p>
<li> <code> f ^F ^V SPACE </code></li>
<p> Scroll forward N lines, a window by default, if N is not specified. </p>
<li> <code> b ^B ESC-v </code></li>
<p> Scroll backward N lines, one window by default, if N is not specified.</p>
<li> <code> ESC-SPACE </code></li>
<p> Scroll forward one window like SPACE , but don't stop at end-of-file. </p>
<li> <code>d ^D </code></li>
<p> Scroll forward N lines, by default N correspond to half of the screen size.</p>
<li> <code> u ^U </code></li>
<p> Scroll Backward N lines, by default N correspond to half of the screen size.</p>
<li> <code> ESC-) RightArrow </code></li>
<p> Scroll horizontally right N characters, by default half of the screen size, if N is not specified.</p>
<li> <code> ESC-( LeftArrow </code></li>
<p> Scroll horizontally left N characters, by default half of the screen size, if N is not specified. </p>
</ol>
<h4> JUMPING </h4>
<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>
<ol>
<li> <code> g < ESC-< </code></li>
<p> Go to line N, by default 1, if N is not specified.</p>
<li> <code> G > ESC-> </code></li>
<p> Go to line N, by default the last one , if N is not specified.</p>
<li> <code> t </code></li>
<p> Go to the (N-th) next tag. </p>
<li> <code> T </code></li>
<p> Go to the (N-th) previous tag.</p>
</ol>
<h4> OPTIONS [Flags] </h4>
<p>Options may be given in one of two forms: either a single
character preceded by a "-", or a name preceded by "--" .</p>
<ol>
<li> <code> ? OR --help </code> </li>
<p> Display help guide with the description of commands and more , it is sufficient to enter less -? .</p>
<li> <code> -c OR --clear-screen </code> </li>
<p> Repaint by clearing rather than scrolling.</p>
<li> <code> -e -E OR --quit-at-eof --QUIT-AT-EOF </code> </li>
<p> Quit the file, when you scroll to the end of the file.</p>
<li> <code> -~ OR --tilde </code> </li>
<p> Do not display tildes after end of file. </p>
</ol>