How to View Files with cat, less and more
Three commands let you read files without an editor: cat prints a file to the screen, less opens a scrollable view for long files, and more is the older, simpler pager. Use cat for short files and less for anything longer than one screen.
Print a file with cat
cat is short for concatenate: it prints file contents to the screen. For short files and configs it is perfect. It also numbers lines with -n.
Scroll a long file with less
less opens a pager: use arrow keys or Page Up/Down to scroll, /text to search, and q to quit. Unlike more, less lets you scroll backwards.
The older pager: more
more shows one screen at a time; press the spacebar for the next page and q to quit. It is simpler but cannot scroll up. Most people use less today.
View multiple files
Both cat and less accept several files. cat prints them one after another, which is how you combine files into one output.
Which one should you use?
Quick glance or piping into another command: cat. Long logs or configs: less. If a command's output flies by too fast, pipe it into less: ps aux | less. See the cat, less and more reference pages for details.
Keep learning
Related guides: How to View File Starts and Ends with head and tail · How to Count and Cut Text with wc and cut · The Nano Text Editor: A Beginner's Guide. Read all tutorials on the Learn Linux blog.