Displaying the Contents of a File with cat

To view the contents of a text file named filename on your screen, use this command:

matthew@seymour:~$ cat filename

Notice that the text is displayed on your screen but that you cannot edit or work with the text in any way. This command is convenient when you want to know the contents of a file but don’t need to make any changes. Text editors for the terminal are covered in Chapter 11, “Command-Line Master Class.” This command works best with short files because the contents of longer files will scroll off of the screen too quickly to be read.

Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition 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.