Files
mkdocs/docs/Linux/bat.md
2021-02-04 09:55:26 +01:00

2.2 KiB

bat

Remplaçant de cat

https://github.com/sharkdp/bat

Installation:

$ brew install bat
$ brew install fzf

Créer le fichier de configuration:

$ bat --generate-config-file

Editer la configuration:

$ nano /Users/bruno/.config/bat/config

Prévisualiser les thèmes:

$ bat --list-themes | fzf --preview="bat --theme={} --color=always /Users/bruno/Documents/Scripts/bash/zsh_tools.sh"

Tail et bat:

$ tail -f /usr/local/var/log/httpd/error_log | bat --paging=never -l log

       STDIN
   1   [Fri Nov 27 16:15:38.788043 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'
   2   [Fri Nov 27 16:22:54.224576 2020] [mpm_prefork:notice] [pid 10014] AH00173: SIGHUP received.  Attempting to restart
   3   [Fri Nov 27 16:22:54.278764 2020] [mpm_prefork:notice] [pid 10014] AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1h PHP/8.0.0 configured -- resuming normal operations
   4   [Fri Nov 27 16:22:54.278819 2020] [core:notice] [pid 10014] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'

Find et bat:

$ find /usr -name error_log -exec bat {} +

-rw-r--r--  1 root wheel      0 Oct 18  2019 rmtab
       File: /usr/local/var/log/httpd/error_log
   1   AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using SilverBook.local. Set the 'ServerName' directive globally to suppress this message
   2   [Tue Aug 06 11:06:14.901395 2019] [mpm_prefork:notice] [pid 51047] AH00163: Apache/2.4.39 (Unix) configured -- resuming normal operations
   3   [Tue Aug 06 11:06:14.904904 2019] [core:notice] [pid 51047] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd -D FOREGROUND'

Man pages:

$ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
man 2 select

bat-extras

https://github.com/eth-p/bat-extras/blob/master/README.md#installation

$ brew install eth-p/software/bat-extras

batman

batgrep

batwatch

batdiff