Unix Reference

The cat command (print out a file to the screen)

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
#include<stdio.h>
#include<stdlib.h>

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

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

cat file1 file2 file3

Back to contents