If there's one thing you're sure to find on a Linux system, it's text files. A lot of them. Readme files, configuration files, documents, and more.

Most of the time, you probably open text files using a text editor. But there is a faster and, I think, better way of reading text files. That's using a utility called less[1]. Standard kit with all Linux distributions (at least the ones I've used), less is a command-line textfile viewer with some useful features.

Don't let the fact that it's a command-line tool scare you. less is very easy to use and has a very shallow learning curve.

Let's take a look at some of the things that you can do with less.

Getting started

Crack open a terminal window and navigate to a directory containing one or more text files that you want to view. Then run the command less filename, where filename is the name of the file you want to view.

The file takes over your terminal window, and you'll notice a colon (:) at the bottom of the window. The colon is where you can type any of the internal commands you use with less. More on these in a moment.

Moving around

Chances are that the text file you're perusing is more than a couple of lines long; it's probably a page or more. With less, you can move forward in the file in a few ways:

  • Move down a page by pressing the spacebar or the PgDn key
  • Move down one line at a time by pressing the Down arrow key

less also allows you to move

Read more from our friends at Opensource.com