Awesome Bash tools

Practice Bash, Zsh, Command-tool

Oh my zsh

As an alternative to the default bash/shell in terminals, I think zsh is an excellent one to use. The oh-my-zsh is a delightful and community-driven framework for managing zsh configurations and it is able to integrate many plugins into zsh by simple steps. You can explore it from its official website.

To install on-my-zsh, simply run the following commands,

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

or

$ sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

Then you’re done!

PowerLevel10k theme

There are many color themes for zsh prompt styles. Here I give my favorite one and the example screenshot is as follows. powerlevel10k screenshot

To install this theme, just clone the git repository as below

$ git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

and set ZSH_THEME="powerlevel10k/powerlevel10k" in your ~/.zshrc file, if you are using oh-my-zsh.

ZSH_THEME="powerlevel10k/powerlevel10k" 

For another installation methods, please refer to the official github.

exa

exa is a very awesome replacement for ls command, with supports for displaying even file type icons. It is mainly written by Rust and hence it will give you a feeling of slow speed. example1

I recommend to install exa by Rust cargo, which is more robust in installations (my experience), using the following single command.

$ cargo install exa

For other installation methods, you can visit the official github and go to the installation section.

fzf

fzf is a good plugin in the terminal to find files or search in the command history. It is so convenient and fast that I am using this feature in my all terminals including the ones on servers. fzf-preview

To install it as a git repository, run the following commands.

$ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
$ ~/.fzf/install

and when the installation is complete, ~/.zshrc will be added automatically to source the configuration fo fzf and you don’t need to worry about it. If you want to use it as a vim plugin, you could add the following line to ~/.vimrc, if you are using vim-plug.

Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

After installing, you can type fzf and then type some word to search for files in current directory recursively or ctrl + r to invoke bash history search mode as follows. fzf-s

For more details, please visit the official site.

zsh-z

zsh-z is a Zsh port of z (GitHub here), which can remember the cd histories and quickly change the directory without typing the whole directory. zsh-z

To install it via oh-my-zsh, run the following commands:

$ git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z

and then add zsh-z to the plugins in .zshrc.

For more information, visit here.

bat

bat is an “advanced” version of cat with the feature that it can recognize the language used in the file and format the output with highlighting accordingly. bat

You can install bat using

$ cargo install bat

or the package manager in your system. Please refer to the Github site for more details.

ncdu

ncdu is a very powerful interactive alternative to df and du commands. ncdu You can navigate into or out of a directory and check how much disk space each directory and file uses. Also, you can delete any files and directories inside the ncdu. you are able to export the scanning results to a json file by ncdu -o <file> and check it in another system with ncdu installed by ncdu -f <file>.

To install the ncdu on Ubuntu, run the command:

$ sudo apt install ncdu

and the source codes and more information can be found in the official site.

tldr

tldr is an interesting and helpful tool with a similar feature of man but tldr can provide more compact information of commands with examples. tldr

To install tldr, you need to have npm and run:

$ npm install -g tldr

It will need to create an index for first use. For more you can visit the official site here.

fd

fd is an easy-to-use alternative to find and it can find entries in the system in a more user-friendly way. But it does not support all of functionality of find. fd is just designed for the majority of usage. fd

There are many installation methods, some of which are:

$ sudo apt install fd-find
$ cargo install fd-find
$ npm install -g fd-find

vimrc

This is an integrated configuration of Vim. If you often use vim to edit files and write codes, this may give you a good feeling. You can check more details here. vim

To install it, run the following commands:

$ git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
$ sh ~/.vim_runtime/install_awesome_vimrc.sh

and as a plugin, vim-plug is very helpful to install additional plugins.

ripgrep

ripgrep is a convenient alternative to grep command with the ability to recursively search files in directories for a regex pattern.

Use the following commands to install ripgrep or other methods provided in the Github repository.

$ apt install ripgrep
$ cargo install ripgrep

libqalculate

libqalculate is a library providing terminal command to perform mathematical calculations including elementary arithmetics, equations, integrals, unit conventions and so on. libqalculate

The installation is somewhat complicated and some errors may occur. I recommend to follow the instructions in Github.

Other interesting tools

There are other impressive tools I am using and I list them here. If you are interested in them, you can visit their websites.

  1. grex
  2. visidata
  3. Thefuck
  4. GDB dashboard
  5. Useful Zsh plugins:
    1. zsh-syntax-highlighting: Syntax highlighting when working on terminal
    2. zsh-autosuggestions: Command autosuggestion

Updated:

Leave a comment