--- 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 ---
Both commands show the content of one or more files and it’s 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.
General syntax for both is:
less [flags] path/name-file.* more [flags] path/name-file.*
The command less
provides some useful commands to navigate and modify the file content.
Commands does not include flags, which are included under Options.
Such commands must be used once the file has been displayed. They are not flags. For a single operation there can be multiple commands.
ENTER RETURN e ^E j ^N CR
:
Scroll forward N lines, 1 by default, if N is not specified. y ^Y k ^K ^P
:
Scroll backward N lines , 1 by default , if N is not specified. f ^F ^V SPACE
:
Scroll forward N lines, a window by default, if N is not specified. b ^B ESC-v
Scroll backward N lines, one window by default, if N is not specified. ESC-SPACE
Scroll forward one window like SPACE , but don't stop at end-of-file.d ^D
Scroll forward N lines, by default N correspond to half of the screen size. u ^U
Scroll Backward N lines, by default N correspond to half of the screen size. ESC-) RightArrow
Scroll horizontally right N characters, by default half of the screen size, if N is not specified. ESC-( LeftArrow
Scroll horizontally left N characters, by default half of the screen size, if N is not specified. Such commands must be used once the file has been displayed. They are not. For a single operation there can be multiple commands.
g < ESC-<
:
Go to line N, by default 1, if N is not specified. G > ESC->
:
Go to line N, by default the last one , if N is not specified. t
:
Go to the (N-th) next tag. T
Go to the (N-th) previous tag. ? OR --help
Display help guide with the description of commands and more , it is sufficient to enter less -? . -c OR --clear-screen
Repaint by clearing rather than scrolling. -e -E OR --quit-at-eof --QUIT-AT-EOF
Quit the file, when you scroll to the end of the file. -~ OR --tilde
Do not display tildes after end of file.