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}}`
|
|
|
|
|
|
|
|
|
|
- Write `stdin` to a file:
|
|
|
|
|
|
|
|
|
|
`cat - > {{path/to/file}}`
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
- Display non-printable and whitespace characters (with `M-` prefix if non-ASCII):
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`cat {{[-vte|--show-nonprinting -t -e]}} {{path/to/file}}`
|