Terminal Fun: Basic Utils

This is the first post of a series where I want to give tips and trick for the Terminal/CLI, have fun:

  • bat and cat
  • exa and ls
  • multitail and tail
  • diff-so-fancy, delta and git diff
  • prettyping and ping
  • htop/gtop/vtop and top

bat instead of cat

bat is a cat replacement with some nice features:

  • Syntax highlighting (the language can be specified)
  • Git integration (shows additions, deletions, modifications)
  • Automatic paging (can pipe its own output to less)
  • File concatenation (in a non-interactive terminal, bat acts as a drop-in replacement for cat)
  • Line numbering
  • Ability to show non-printable characters like space, tab or newline
  • Line highlighting (highlight the specified line ranges with a different background color)
  • Text wrapping
  • Themes

If you want to use the original cat command: command cat whatever.txt
Check out the readme and the man page, you can install it via homebrew.

Setup tip:

export BAT_STYLE='full'
alias cat='bat'

exa instead of ls

exa is a replacement for ls with:

  • Colored output
  • Git status
  • Tree view

If you want to use the original ls command: command ls
Check out the readme, the man page and the official website, you can install it via homebrew.

Setup tip:

alias la='ls -alh --git'
alias ls='exa'

MultiTail

MultiTail is like tail but it allows you to print multiple files in multiple windows (with ncurses). It can colorize, filter and merge, check out the list of features, you can install it via homebrew.

diff-so-fancy and delta

diff-so-fancy makes git diffs human readable.

Setup tip (.gitconfig):

[pager]
    diff = diff-so-fancy | less --tabs=4 -RFX
    show = diff-so-fancy | less --tabs=4 -RFX

Check out the readme, and the pro tips, you can install it via homebrew.

ManikMagar suggested delta which seems even better.

Setup tip (.gitconfig):
First, run delta --list-themes to see the themes, then:

[core]
    pager = delta --theme='ansi-dark'
[interactive]
    diffFilter = delta --color-only

Check out the readme, so that you can see how to choose a theme (and also the potential issue with bat), you can install it via homebrew.

prettyping instead of ping

prettyping wraps ping and makes its output prettier: colorful, compact, easier to read and it shows live stats nicely.


Setup tip:

alias ping='prettyping'

Check out the readme and the official page, you can install it via homebrew.

htop instead of top

Hope you know htop, it’s an interactive process viewer, you can install it via homebrew.

Setup tip:

alias top='sudo htop'

Have you heard about gtop or vtop?

gtop

vtop

Posts in this series