2025-03-14 21:59:59 -06:00
|
|
|
# cat
|
|
|
|
|
|
|
|
|
|
> Print and concatenate files.
|
|
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html>.
|
|
|
|
|
|
|
|
|
|
- Print the contents of a file to `stdout`:
|
|
|
|
|
|
|
|
|
|
`cat {{path/to/file}}`
|
|
|
|
|
|
|
|
|
|
- Concatenate several files into an output file:
|
|
|
|
|
|
|
|
|
|
`cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}`
|
|
|
|
|
|
|
|
|
|
- Append several files to an output file:
|
|
|
|
|
|
|
|
|
|
`cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}`
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Write to a file interactively:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`cat > {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
- Number all output lines:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`cat {{[-n|--number]}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Display all characters, including tabs, line endings, and non-printing characters:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`cat {{[-A|--show-all]}} {{path/to/file}}`
|
|
|
|
|
|
|
|
|
|
- Pass file contents to another program through `stdin`:
|
|
|
|
|
|
|
|
|
|
`cat {{path/to/file}} | {{program}}`
|