简介
-
提供美观、高级的语法突出显示 -
与 Git 集成以显示文件修改 -
成为 (POSIX) cat
的直接替代品 -
提供用户友好的命令行界面 -
项目地址:https://github.com/sharkdp/bat -
安装
-
sudo apt install bat
-
apk add bat
-
pacman -S bat
-
dnf install bat
-
emerge sys-apps/bat
-
xbps-install -S bat
-
pkg install bat
-
brew install bat
-
cargo install --locked bat
参数选项
❯ bat -h
A cat(1) clone with wings.
Usage: bat [OPTIONS] [FILE]...
bat <COMMAND>
Arguments:
[FILE]... File(s) to print / concatenate. Use '-' for standard input.
Options:
-A, --show-all
Show non-printable characters (space, tab, newline, ..).
--nonprintable-notation <notation>
Set notation for non-printable characters.
-p, --plain...
Show plain style (alias for '--style=plain').
-l, --language <language>
Set the language for syntax highlighting.
-H, --highlight-line <N:M>
Highlight lines N through M.
--file-name <name>
Specify the name to display for a file.
-d, --diff
Only show lines that have been added/removed/modified.
--tabs <T>
Set the tab width to T spaces.
--wrap <mode>
Specify the text-wrapping mode (*auto*, never, character).
-S, --chop-long-lines
Truncate all lines longer than screen width. Alias for '--wrap=never'.
-n, --number
Show line numbers (alias for '--style=numbers').
--color <when>
When to use colors (*auto*, never, always).
--italic-text <when>
Use italics in output (always, *never*)
--decorations <when>
When to show the decorations (*auto*, never, always).
--paging <when>
Specify when to use the pager, or use `-P` to disable (*auto*, never, always).
-m, --map-syntax <glob:syntax>
Use the specified syntax for files matching the glob pattern ('*.cpp:C++').
--theme <theme>
Set the color theme for syntax highlighting.
--list-themes
Display all supported highlighting themes.
--style <components>
Comma-separated list of style elements to display (*default*, auto, full, plain, changes,
header, header-filename, header-filesize, grid, rule, numbers, snip).
-r, --line-range <N:M>
Only print the lines from N to M.
-L, --list-languages
Display all supported languages.
-h, --help
Print help (see more with '--help')
-V, --version
Print version
使用
-
bat [file.md](http://file.md)
bat 命令查看 markdown 文档 -
-
bat
能从 git 中获取文件的修改并展示在边栏 -
-
bat -A file
打印不可见字符 -
-
curl -s https://sh.rustup.rs | bat
读取输入流显示 -
Refences
-
https://github.com/sharkdp/bat
原文始发于微信公众号(人遁安全):Cat 命令的高级替代
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论