Ad space (banner)
🖥️Linux Lessons
Lesson 9 / 61

Viewing a File's Contents with cat

cat is for when "I want to display a file's contents directly on screen." cat stands for concatenate, and it outputs the contents of the given file straight to the terminal.

Use it in the form cat filename. Line up multiple filenames, and their contents get concatenated and shown one after another.

Running cat notes.txt displays the contents of notes.txt directly in the terminal. It's handy for quickly checking a short file's content.

A common early mistake is using cat on a very large file, and a flood of lines scrolls by too fast to read. For long files, head or less is a better fit.

In real work, this is one of the most frequently used commands for quickly checking the contents of a config file or log file.

Linux
Try it (type this into the pseudo terminal)
cat notes.txt

🧑‍💻 You can type this command into the Linux pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)