--- layout: page category_title: Basic commands category-page: basic tags: More and less author: Marzio Lunghi title: More and Less ---

More and Less

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:

      Device-name:Current-position username$ less [flags] path/name-file.*
      
Device-name:Current-position username$ more [flags] path/name-file.*
Less provides some useful commands to navigate and modify the file content. Commands does not include flags, which are included under Options.

Commands and flags

MOVING

Such commands must be used once the file has been displayed. They are not flags. For a single operation there can be multiple commands.

  1. ENTER RETURN e ^E j ^N CR
  2. Scroll forward N lines, 1 by default, if N is not specified.

  3. y ^Y k ^K ^P
  4. Scroll backward N lines , 1 by default , if N is not specified.

  5. f ^F ^V SPACE
  6. Scroll forward N lines, a window by default, if N is not specified.

  7. b ^B ESC-v
  8. Scroll backward N lines, one window by default, if N is not specified.

  9. ESC-SPACE
  10. Scroll forward one window like SPACE , but don't stop at end-of-file.

  11. d ^D
  12. Scroll forward N lines, by default N correspond to half of the screen size.

  13. u ^U
  14. Scroll Backward N lines, by default N correspond to half of the screen size.

  15. ESC-) RightArrow
  16. Scroll horizontally right N characters, by default half of the screen size, if N is not specified.

  17. ESC-( LeftArrow
  18. Scroll horizontally left N characters, by default half of the screen size, if N is not specified.

JUMPING

Such commands must be used once the file has been displayed. They are not. For a single operation there can be multiple commands.

  1. g < ESC-<
  2. Go to line N, by default 1, if N is not specified.

  3. G > ESC->
  4. Go to line N, by default the last one , if N is not specified.

  5. t
  6. Go to the (N-th) next tag.

  7. T
  8. Go to the (N-th) previous tag.

OPTIONS [Flags]

Options may be given in one of two forms: either a single character preceded by a "-", or a name preceded by "--" .

  1. ? OR --help
  2. Display help guide with the description of commands and more , it is sufficient to enter less -? .

  3. -c OR --clear-screen
  4. Repaint by clearing rather than scrolling.

  5. -e -E OR --quit-at-eof --QUIT-AT-EOF
  6. Quit the file, when you scroll to the end of the file.

  7. -~ OR --tilde
  8. Do not display tildes after end of file.