mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
38 lines
886 B
Plaintext
38 lines
886 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, linux]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# 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 to a file interactively:
|
|
|
|
`cat > {{path/to/file}}`
|
|
|
|
- Number all output lines:
|
|
|
|
`cat {{[-n|--number]}} {{path/to/file}}`
|
|
|
|
- Display all characters, including tabs, line endings, and non-printing characters:
|
|
|
|
`cat {{[-A|--show-all]}} {{path/to/file}}`
|
|
|
|
- Pass file contents to another program through `stdin`:
|
|
|
|
`cat {{path/to/file}} | {{program}}`
|