View text files in Terminal on Mac
To look at the contents of a text-based configuration file, use
Generally, you’ll use
less because it has more options (such as searching).
less, enter 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.
less tool also lets you search in a file. Enter / 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
J or Down Arrow
Scroll down a line
K or Up Arrow
Scroll up a line
Find the next occurrence of a search term
Find the previous occurrence of a search term