1BAT(1)                      General Commands Manual                     BAT(1)
2
3
4

NAME

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

USAGE

9       bat [OPTIONS] [FILE]...
10
11       bat cache [CACHE-OPTIONS] [--build|--clear]
12

DESCRIPTION

14       bat  prints  the syntax-highlighted content of a collection of FILEs to
15       the terminal. If no FILE is specified, or when FILE is  '-',  it  reads
16       from standard input.
17
18       bat  supports  a  large number of programming and markup languages.  It
19       also communicates with git(1) to show modifications with respect to the
20       git  index.   bat  automatically  pipes  its output through a pager (by
21       default: less).
22
23       Whenever the output of bat goes to  a  non-interactive  terminal,  i.e.
24       when  the output is piped into another process or into a file, bat will
25       act as a drop-in replacement for cat(1) and fall back to  printing  the
26       plain file contents.
27
28

OPTIONS

30       General  remarks: Command-line options like '-l'/'--language' that take
31       values  can  be  specified  as  either  '--language   value',   '--lan‐
32       guage=value', '-l value' or '-lvalue'.
33
34       -A, --show-all
35
36              Show  non-printable  characters  like space, tab or newline. Use
37              '--tabs' to control the width of the tab-placeholders.
38
39       -p, --plain
40
41              Only show plain style, no decorations.  This  is  an  alias  for
42              '--style=plain'.  When  '-p' is used twice ('-pp'), it also dis‐
43              ables    automatic    paging    (alias    for     '--style=plain
44              --pager=never').
45
46       -l, --language <language>
47
48              Explicitly  set  the  language for syntax highlighting. The lan‐
49              guage can be specified as a name (like 'C++' or 'LaTeX') or pos‐
50              sible   file   extension   (like  'cpp',  'hpp'  or  'md').  Use
51              '--list-languages' to show all supported language names and file
52              extensions.
53
54       -H, --highlight-line <N:M>...
55
56              Highlight  the specified line ranges with a different background
57              color For example:
58
59              --highlight-line 40
60                     highlights line 40
61
62              --highlight-line 30:40
63                     highlights lines 30 to 40
64
65              --highlight-line :40
66                     highlights lines 1 to 40
67
68              --highlight-line 40:
69                     highlights lines 40 to the end of the file
70
71       --tabs <T>
72
73              Set the tab width to T spaces. Use a width of  0  to  pass  tabs
74              through directly
75
76       --wrap <mode>
77
78              Specify  the  text-wrapping mode (*auto*, never, character). The
79              '--terminal-width' option can be used in addition to control the
80              output width.
81
82       --terminal-width <width>
83
84              Explicitly  set the width of the terminal instead of determining
85              it automatically. If prefixed with '+' or '-', the value will be
86              treated  as  an  offset  to the actual terminal width. See also:
87              '--wrap'.
88
89       -n, --number
90
91              Only show line numbers, no other decorations. This is  an  alias
92              for '--style=numbers'
93
94       --color <when>
95
96              Specify  when  to  use  colored  output. The automatic mode only
97              enables colors if an interactive terminal is detected.  Possible
98              values: *auto*, never, always.
99
100       --italic-text <when>
101
102              Specify  when  to use ANSI sequences for italic text in the out‐
103              put. Possible values: always, *never*.
104
105       --decorations <when>
106
107              Specify when to use the decorations that have been specified via
108              '--style'.  The  automatic  mode  only enables decorations if an
109              interactive  terminal  is  detected.  Possible  values:  *auto*,
110              never, always.
111
112       --paging <when>
113
114              Specify  when  to use the pager. To control which pager is used,
115              set the PAGER or BAT_PAGER  environment  variables  (the  latter
116              takes  precedence)  or  use the '--pager' option. To disable the
117              pager permanently, set BAT_PAGER  to  an  empty  string  or  set
118              '--paging=never'  in  the  configuration  file. Possible values:
119              *auto*, never, always.
120
121       --pager <command>
122
123              Determine which pager is used. This option  will  overwrite  the
124              PAGER  and BAT_PAGER environment variables. The default pager is
125              'less'. To disable the  pager  completely,  use  the  '--paging'
126              option. Example: '--pager "less -RF"'.
127
128       -m, --map-syntax <glob-pattern:syntax-name>...
129
130              Map  a glob pattern to an existing syntax name. The glob pattern
131              is matched on the full path and the filename.  For  example,  to
132              highlight   *.build   files  with  the  Python  syntax,  use  -m
133              '*.build:Python'. To highlight files named '.myignore' with  the
134              Git Ignore syntax, use -m '.myignore:Git Ignore'.
135
136       --theme <theme>
137
138              Set  the  theme  for syntax highlighting. Use '--list-themes' to
139              see all available themes.  To  set  a  default  theme,  add  the
140              '--theme="..."'  option  to the configuration file or export the
141              BAT_THEME environment variable (e.g.: export BAT_THEME="...").
142
143       --list-themes
144
145              Display a list of supported themes for syntax highlighting.
146
147       --style <style-components>
148
149              Configure which elements (line numbers, file headers, grid  bor‐
150              ders,  Git modifications, ..) to display in addition to the file
151              contents. The argument is a comma-separated list  of  components
152              to  display (e.g. 'numbers,changes,grid') or a pre-defined style
153              ('full').  To set a default style, add the '--style=".."' option
154              to  the  configuration  file or export the BAT_STYLE environment
155              variable (e.g.: export BAT_STYLE=".."). Possible values: *auto*,
156              full, plain, changes, header, grid, numbers, snip.
157
158       -r, --line-range <N:M>...
159
160              Only print the specified range of lines for each file. For exam‐
161              ple:
162
163              --line-range 30:40
164                     prints lines 30 to 40
165
166              --line-range :40
167                     prints lines 1 to 40
168
169              --line-range 40:
170                     prints lines 40 to the end of the file
171
172       -L, --list-languages
173
174              Display a list of supported languages for syntax highlighting.
175
176       -u, --unbuffered
177
178              This option exists for  POSIX-compliance  reasons  ('u'  is  for
179              'unbuffered').  The output is always unbuffered - this option is
180              simply ignored.
181
182       -h, --help
183
184              Print this help message.
185
186       -V, --version
187
188              Show version information.
189

POSITIONAL ARGUMENTS

191       <FILE>...
192
193              Files to print and concatenate. Use a dash ('-') or no  argument
194              at all to read from standard input.
195

SUBCOMMANDS

197       cache - Modify the syntax-definition and theme cache.
198

FILES

200       bat  can  also be customized with a configuration file. The location of
201       the file is dependent on your operating system. To get the default path
202       for your system, call:
203
204       bat --config-file
205
206       Alternatively,  you can use the BAT_CONFIG_PATH environment variable to
207       point bat to a non-default location of the configuration file.
208
209
210
211                                                                        BAT(1)
Impressum