7. cat (Concatenate)

Lesson Content

We’re almost done navigating files, but first let’s learn how to read a file. A simple command to use is the cat command, short for concatenate, it not only displays file contents but it can combine multiple files and show you the output of them.

$ cat dogfile birdfile

It’s not great for viewing large files and it’s only meant for short content. There are many other tools that we use to view larger text files that we’ll discuss in the next lesson.

Exercise

Run cat on different files and directories. Then try to cat multiple files.

Quiz Question

# What's a good way to see the contents of a file? > It can be used to display the content of a file, copy content from one file to another, concatenate the contents of multiple files. 1. [ ] read 2. [ ] add 3. [ ] cd 4. [x] cat