less – navigate and view text files

less command used to scroll through its man page

less command continues traditions of a simple text file viewer of the more command (in many ways, less IS more) but does it with a number of key optimisations.

For most day to day text viewing needs, less is the best default option on any modern Unix or Linux operating system.

Navigating text files with less

Just like with more command, less allows you to skip text file to its next page (screen) by pressing the Space key.

But it also allows you to use Up and Down keys for navigating text file easily.

PgUp and PgDown (Fn+Up and Fn+Down in MacOS) keys help you scroll one screen up or down respectively.

Advantages over more command

There’s two big advantages:

  1. less doesn’t read the whole text file – it only reads enough to show you the output (and will keep seeking and reading more as you scroll) – this becomes a noticeable improvement when working with particularly large (gigabytes) text files
  2. Scrolling with arrow keys – strict implementations of more command (macOS and other Unix implementations) don’t allow you to scroll back – so you can only keep jumping one screen of information further at a time. less is super-useful for searching sections of text and then scrolling around to confirm context.

See Also