2014-05-10 15:23:41 +03:00
|
|
|
# cat
|
|
|
|
|
|
|
|
> Print and concatenate files.
|
2024-02-19 11:13:42 -03:00
|
|
|
> More information: <https://manned.org/cat.1posix>.
|
2014-05-10 15:23:41 +03:00
|
|
|
|
2023-08-09 07:29:02 +02:00
|
|
|
- Print the contents of a file to `stdout`:
|
2014-05-10 15:23:41 +03:00
|
|
|
|
2022-10-01 10:11:48 +00:00
|
|
|
`cat {{path/to/file}}`
|
2014-05-10 15:23:41 +03:00
|
|
|
|
2022-10-01 10:11:48 +00:00
|
|
|
- Concatenate several files into an output file:
|
2014-05-10 15:23:41 +03:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
`cat {{path/to/file1 path/to/file2 ...}} > {{path/to/output_file}}`
|
2015-12-29 18:45:42 -08:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
- Append several files to an output file:
|
2015-12-29 18:45:42 -08:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
`cat {{path/to/file1 path/to/file2 ...}} >> {{path/to/output_file}}`
|
2016-01-18 22:23:18 +08:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
- Copy the contents of a file into an output file without buffering:
|
2016-01-18 22:23:18 +08:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
`cat -u {{/dev/tty12}} > {{/dev/tty13}}`
|
2019-07-03 03:52:13 +01:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
- Write `stdin` to a file:
|
2019-07-03 03:52:13 +01:00
|
|
|
|
2022-12-21 04:18:13 +01:00
|
|
|
`cat - > {{path/to/file}}`
|