cat
What is cat?
cat: Concatenate and print — Print the entire contents of a file to the terminal. cat prints the contents of a file to the terminal. Its name comes from concatenate, because it can also join several files: cat part1.csv part2.csv > all.csv. It is the quickest way to look at a short file, such as a config file or a small log. For anything long, less is better, because it lets you scroll and search instead of flooding the screen.
Frequently asked questions about cat
What should you keep in mind with cat?
You often see cat file | grep something. It works, but grep something file does the same without the extra process. For logs that are still being written, tail -f follows new lines as they arrive. And be careful with cat on files that might contain secrets, such as .env, when you are sharing your screen or recording a session.
At a glance
| Category | CLI commands |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |