Printing Out a File With cat

Written by Chris Gregg, with modifications by Nick Troccoli

Click here for a walkthrough video.

The cat command ("concatenation") is a simple command that prints files to the terminal, one after the other. We normally use it for a single file, and it is a quick way to see inside a file without opening an editor. Here is an example:

$ cat hello.c

int main() {
    printf("Hello, World!\n");
    return 0;

You can also use cat to print multiple files, e.g.,

cat file1 file2 file3

Another command, more, is similar to cat, but instead of displaying the entire file in one go, more lets you scroll through it. You can use these keystrokes to scroll: