less – navigate and view text files

less command less command

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.

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:

  • 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
  • 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




Contact Me

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
03 Sep 2024

macOS Sequoia 15.0

02 Sep 2024

Video: Has This Worked Before?

24 Mar 2024

Homelab: Mac Pro 2013 32GB

Recent Tweets