Viewing Text Files

Linux distributions come with a number of text-viewing programs. The following sections discuss several of these programs, such as the cat command and interactive viewers (called pagers), that you can use to view text files without running a text editor.

Viewing Text Files with the cat Command

Use the cat (concatenate) command to print the contents of files to your console display or terminal window. This command is best used to print short files to your display because long files will scroll too fast for you to read.

$ cat /etc/issue
Red Hat Linux release 5.0 (Hurricane)
Kernel 2.0.31 on an i586

Use the cat command's -n (line-numbering) option to have file listings automatically numbered:

 $ cat -n /etc/issue 1 2 Red Hat Linux ...

Get Practical Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.