cat (from the English concatenate ) is a UNIX utility that displays sequentially specified files (or devices), thus combining them into a single stream. If "-" is specified instead of the file name, then standard input is read.
cat a.txt - b.txt> abc.txt
cat / dev / null> file_to_clear.txt
Sometimes (in training examples) it is used as the first step of the text processing pipeline by sed , awk and so on, although in most cases it can be replaced with the '<' operator or by passing the file name as an argument, which avoids creating a separate process . It can be used in the following cases:
- when you want to display a file somewhere without changes;
- when it is necessary to combine more than one file (for example, parts of a single file split by the split command), or file (s) with a standard input stream;
- when you want to view the contents of a file.
Analogs in other operating systems
On Windows, for similar purposes, you can use the following command:
copy / b a.txt + b.txt abc.txt