Akshay K P

Linux
Some of the best Linux command-line tools like zoxide, fzf, and eza for a better terminal experience.

Useful Linux CLI Tools

Table of Contents

  1. Introduction
  2. Useful CLI Tools
  3. Installation
  4. Conclusion

Introduction

The Linux terminal is a powerful environment and with the right tools, you can significantly boost your productivity.

Useful CLI Tools

zoxide

zoxide is a smarter alternative to the cd command. It tracks your frequently used directories and allows you to jump to them with minimal keystrokes using a ranking algorithm. I use it a lot.

Example usage:

$ z foo       # Navigate to the highest-ranked directory matching "foo"
$ z foo bar   # Navigate to a directory matching both "foo" and "bar"
$ zi foo      # Interactive selection with fzf

fzf

fzf is a command-line fuzzy finder that integrates with other tools to provide an interactive search interface. It’s perfect for quickly finding files, directories, or command history.

Example usage:

# Fuzzy search for files
fzf
# Use with cd for interactive directory navigation
$ cd $(fzf --preview 'eza --tree --color=always {}')

eza

eza is a modern replacement for the ls command, offering colorful output, git integration, and tree-like directory views.

Example usage:

$ eza --long --git  # Detailed file listing with git status
$ eza --tree        # Display directory structure

Installation

To install these tools on Arch Linux, use the following commands:

# Install zoxide
$ sudo pacman -S zoxide

# Install fzf
$ sudo pacman -S fzf

# Install eza
$ sudo pacman -S eza

After installation, configure your shell (e.g., Bash, Zsh) to enable zoxide and fzf features. Add the following to your ~/.zshrc or ~/.bashrc:

# Initialize zoxide
$ eval "$(zoxide init zsh)"  # Use 'bash' instead of 'zsh' for Bash

# Configure fzf
$ source /usr/share/fzf/key-bindings.zsh
$ source /usr/share/fzf/completion.zsh

Close and reopen your terminal or source the configuration file (source ~/.zshrc) to apply changes.

Note: Ensure you have git installed for eza’s git integration: sudo pacman -S git.

Conclusion

Tools like zoxide, fzf, and eza saves time. Using zoxide with cd as alias saves a lot of time, without loosing years of muscle memory of typing cd. In case of fzf, i mostly use fzf -q searchterm. I rarely use eza, but it is useful when its needed, the colors & icons make it easier to find the details of what I am looking for.

(Used chatgpt for formatting & grammer.)