View file contents

To look at the contents of a text-based configuration file, use cat or less.

Generally, you’ll use less because it has more options (such as searching).

To use less, type the command name followed by the name of the file you want to view. The first page of text fills the window. To view the next page, press the Space bar.

The less tool also lets you search in a file. Type / followed by the phrase you’re searching for. If the phrase has spaces in it, precede each space with \:

/I\ read\ the\ other\ day

The following table lists some other useful keys for navigating the output from less.

Key command

Action

J or Down Arrow

Scroll down a line

K or Up Arrow

Scroll up a line

N

Find the next occurrence of a search term

P

Find the previous occurrence of a search term

Q

Quit less

For more information about the less command, see its man page.