bat man page

bat — manual page for bat

TL;DR

bat file

bat file1 file2 > target_file

bat file1 file2 >> target_file

bat -n file

bat --language json file.json

bat --list-language

Description

bat - a cat(1) clone with syntax highlighting and Git integration.

Usage

bat [Options] [FILE]...

bat <SUBCOMMAND>

Options

-l, --language <language>

Explicitly set the language for syntax highlighting. The language can be specified as a name (like 'C++' or 'LaTeX') or possible file extension (like 'cpp', 'hpp' or 'md'). Use '--list-languages' to show all supported language names and file extensions.

--list-languages

Display a list of supported languages for syntax highlighting.

--theme <theme>

Set the theme for syntax highlighting. Use '--list-themes' to see all available themes. To set a default theme, export the BAT_THEME environment variable (e.g.: export BAT_THEME="TwoDark").

--list-themes

Display a list of supported themes for syntax highlighting.

--style <style-components>

Configure which elements (line numbers, file headers, grid borders, Git modifications, ..) to display in addition to the file contents. The argument is a comma-separated list of components to display (e.g. 'numbers,changes,grid') or a pre-defined style ('full'). To set a default theme, export the BAT_STYLE environment variable (e.g.: export BAT_STYLE="numbers"). [possible values: auto, full, plain, changes, header, grid, numbers]

-p

Only show plain style, no decorations. This is an alias for '--style=plain'

-n, --number

Only show line numbers, no other decorations. This is an alias for '--style=numbers'

--line-range <N:M>

Only print the specified range of lines for each file. For example:

--line-range 30:40

prints lines 30 to 40

--line-range :40

prints lines 1 to 40

--line-range 40:

prints lines 40 to the end of the file

--color <when>
Specify when to use colored output. The automatic mode only enables colors if an interactive terminal is detected. [default: auto]  [possible values: auto, never, always]
--decorations <when>
Specify when to use the decorations that have been specified via '--style'. The automatic mode only enables decorations if an interactive terminal is detected. [default: auto]  [possible values: auto, never, always]
--paging <when>
Specify when to use the pager. To control which pager is used, set the PAGER or BAT_PAGER environment variables (the latter takes precedence). The default pager is 'less'. To disable the pager permanently, set BAT_PAGER to an empty string. [default: auto]  [possible values: auto, never, always]

--wrap <mode>

Specify the text-wrapping mode. [default: auto]

[possible values: auto,

never, character]

-u

This option exists for POSIX-compliance reasons ('u' is for 'unbuffered'). The output is always unbuffered - this option is simply ignored.

--tabs <tabs>

Sets the tab width. Use a width of 0 to pass tabs through directly

-h, --help

Print this help message.

-V, --version

Show version information.

Args

<FILE>...

File(s) to print / concatenate. Use a dash ('-') or no argument at all to read from standard input.

Subcommands

cache

Modify the syntax-definition and theme cache. See "bat cache --help" for more information