Cat 命令的高级替代

admin 2024年6月16日22:38:24评论3 views字数 2574阅读8分34秒阅读模式
Cat 命令的高级替代

简介

  • 提供美观、高级的语法突出显示
  • 与 Git 集成以显示文件修改
  • 成为 (POSIX) cat 的直接替代品
  • 提供用户友好的命令行界面
  • 项目地址:https://github.com/sharkdp/bat
  • Cat 命令的高级替代

安装

  • 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 文档
  • Cat 命令的高级替代

  • bat 能从 git 中获取文件的修改并展示在边栏
  • Cat 命令的高级替代

  • bat -A file 打印不可见字符
  • Cat 命令的高级替代

  • curl -s https://sh.rustup.rs | bat   读取输入流显示
  • Cat 命令的高级替代

Refences

  • https://github.com/sharkdp/bat

原文始发于微信公众号(人遁安全):Cat 命令的高级替代

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年6月16日22:38:24
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Cat 命令的高级替代https://cn-sec.com/archives/2853337.html

发表评论

匿名网友 填写信息