tldr/pages/common/bat.md

38 lines
1.1 KiB
Markdown
Raw Normal View History

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