cat
Print a file in the terminal, number its lines, or join several files into one output.
>_ Try it: a simulated Linux, right herenothing runs on your computer
Loading the terminal…
Examples
-
cat todo.txt -
cat -n ideas.txt -
cat todo.txt ideas.txt -
cat /etc/os-release -
cat todo.txt | grep docker
How it works
cat FILE prints the whole file in the terminal. It is the quickest way to read a config file or a short note.
Give it several files and it prints them one after the other (that is where the name comes from: concatenate). For long files, head and tail show just the start or the end.
Syntax
cat [OPTION]... FILE...
Options
| Option | What it does |
|---|---|
-n | number every line |
Good to know
catis not for folders:cat notessays "Is a directory". Usels notesto look inside a folder.- Piping
catintogrepworks, butgrep docker todo.txtdoes the same with one command.