2018-09-06 19:07:32 +05:30
|
|
|
# bat
|
|
|
|
|
|
|
|
> Print and concatenate files.
|
|
|
|
> A `cat` clone with syntax highlighting and Git integration.
|
2020-10-24 09:45:49 -03:00
|
|
|
> More information: <https://github.com/sharkdp/bat>.
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2024-03-06 12:34:16 +11:00
|
|
|
- Pretty print the contents of one or more files to `stdout`:
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2024-01-31 00:55:19 -03:00
|
|
|
`bat {{path/to/file1 path/to/file2 ...}}`
|
2018-09-06 19:07:32 +05:30
|
|
|
|
|
|
|
- Concatenate several files into the target file:
|
|
|
|
|
2024-01-31 00:55:19 -03:00
|
|
|
`bat {{path/to/file1 path/to/file2 ...}} > {{path/to/target_file}}`
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2024-03-06 12:34:16 +11:00
|
|
|
- Remove decorations and disable paging (`--style plain` can be replaced with `-p`, or both options with `-pp`):
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2024-03-06 12:34:16 +11:00
|
|
|
`bat --style plain --pager never {{path/to/file}}`
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2024-03-06 12:34:16 +11:00
|
|
|
- Highlight a specific line or a range of lines with a different background color:
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2025-03-08 16:43:04 +02:00
|
|
|
`bat {{[-H|--highlight-line]}} {{10|5:10|:10|10:|10:+5}} {{path/to/file}}`
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2024-03-06 12:34:16 +11:00
|
|
|
- Show non-printable characters like space, tab or newline:
|
2018-09-06 19:07:32 +05:30
|
|
|
|
2025-03-08 16:43:04 +02:00
|
|
|
`bat {{[-A|--show-all]}} {{path/to/file}}`
|
2024-03-06 12:34:16 +11:00
|
|
|
|
|
|
|
- Remove all decorations except line numbers in the output:
|
|
|
|
|
2025-03-08 16:43:04 +02:00
|
|
|
`bat {{[-n|--number]}} {{path/to/file}}`
|
2024-03-06 12:34:16 +11:00
|
|
|
|
|
|
|
- Syntax highlight a JSON file by explicitly setting the language:
|
|
|
|
|
2025-03-08 16:43:04 +02:00
|
|
|
`bat {{[-l|--language]}} json {{path/to/file.json}}`
|
2018-09-06 19:07:32 +05:30
|
|
|
|
|
|
|
- Display all supported languages:
|
|
|
|
|
2025-03-08 16:43:04 +02:00
|
|
|
`bat {{[-L|--list-languages]}}`
|