Viewing File Contents

Unix offers a few tools for examining the contents of files:

  • cat (concatenate) lists one or more files to the Terminal window.

  • less outputs files in page-size chunks, enabling you to view the contents of large files one screen at a time.

  • head displays the first lines of a file.

  • tail displays the last lines of a file.

  • wc displays a count of the number of lines, words, and characters in a file.

✓ Tip

  • To learn more about these commands, check out their man pages. Type man cat, man less, man head, man tail, or man wc and press to display the command’s man page.

To list a file’s contents

Type cat file ... (for example, cat example.rtf ...

Get Mac OS X 10.4 Tiger: Visual QuickStart Guide 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.