DEV Community

Cover image for 5 Modern CLI tools that help boost your productivity
Anish De
Anish De

Posted on • Updated on • Originally published at blog.anishde.dev

5 Modern CLI tools that help boost your productivity

As developers, most of us use the terminal to interact with our computers for many tasks as we find it more productive. We are familiar with commands like ls, cd, cat, grep, and find. These are primarily pre-installed on our computers and mostly get the job done hence, we never consider looking for any alternatives.

But, today we are going to look at 5 alternatives that accomplish the same task but are more feature-rich, faster, and cleaner. Coincidentally, these are all written in the rust programming language.

bat

bat is a popular alternative for the cat command, just with a ton of more features. So, what are they?

Syntax highlighting

bat automatically provides syntax highlighting for all major programming languages.

Line numbers

This might not be a big one but bat shows line numbers, and I have found it extremely useful.

image.png

Search

image.png

We can use / and then enter a query (can be regex) to perform a search operation. This is similar to how it is done in vim, and yes, it supports vim keybindings like n to go to the next result and N to go to the previous result.

zoxide

zoxide behaves like cd at first glance but it has 1 feature which makes it a game-changer. How cool would it be if you did not have to specify the path to a directory every time you wanted to change into it? Zoxide stores paths in a db, and the next time you use it, you can just specify the directory name instead of the full path. Here it is in action (z is the default alias for zoxide) -

image.png

You can also use the zi command to interactively select previous paths using fzf -

image.png

exa

exa is a modern replacement for the ls command but with more features. First of all, it supports colors and icons (I have aliased ls to exa --icons --color=always) -

image.png

This makes distinguishing folders and files extremely easy and the icons are just a great touch. Also, the list view (pass in the -l to see it in the list view) is way cleaner.

Exa also comes with a handy tree feature -

image.png

Here, -T is for displaying it as a tree. The --git-ignore flag ignores files and folders mentioned in the .gitignore ignore file.

fd

fd is an alternative to the find command packed with features and is also extremely fast.

image.png

The first argument is the term we want to search and any other arguments after that will be directories to search in.

We can also specify an extension with the -e flag -

image.png

ripgrep

ripgrep is an alternative to the grep command and the main highlight is its speed. It also automatically ignores files specified in ignore files like .gitignore and .ignore.

image.png

Yes, that took just 20 milliseconds!

Ripgrep comes with many other features too, like searching in specific file types and searching inside zips.

image.png

Here, we can specify the file type using the -t flag.

BONUS: tealdeer

tealdeer is an alternative to the tldr tool. Both accomplish the same task, that is, showing community-driven help/man pages which are easier to read and understand than the traditional, detailed ones. Here is an example for exa -

image.png

Tealdeer installs as tldr and hence tldr is the command and not tealdeer.

Conclusion

I hope you have found this article useful and that it helped boost your productivity. You can leave any suggestions via comments or you can dm them to me on Twitter :)

Latest comments (5)

Collapse
Collapse
 
ccoveille profile image
Christophe Colombier • Edited

I would add delta, the git diff helper

GitHub logo dandavison / delta

A syntax-highlighting pager for git, diff, and grep output

image

CI Coverage Status Gitter

Get Started

Install it (the package is called "git-delta" in most package managers, but the executable is just delta) and add this to your ~/.gitconfig:

[core]
    pager = delta

[interactive]
    diffFilter = delta --color-only
[add.interactive]
    useBuiltin = false # required for git 2.37.0

[delta]
    navigate = true    # use n and N to move between diff sections
    light = false      # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)

[merge]
    conflictstyle = diff3

[diff]
    colorMoved = default
Enter fullscreen mode Exit fullscreen mode

Delta has many features and is very customizable; please see the user manual.

Features

  • Language syntax highlighting with the same syntax-highlighting themes as bat
  • Word-level diff highlighting using a Levenshtein edit inference algorithm
  • Side-by-side view with line-wrapping
  • Line numbering
  • n and N keybindings to move between…

This one was really a life changer for me

Collapse
 
anishde12020 profile image
Anish De

This one looks good, will try using it :D

Collapse
 
ccoveille profile image
Christophe Colombier • Edited

I agree with you.

It reminds me this good list

GitHub logo ibraheemdev / modern-unix

A collection of modern/faster/saner alternatives to common unix commands.

Modern Unix

bat

A cat clone with syntax highlighting and Git integration.

exa

A modern replacement for ls.

lsd

The next gen file listing command. Backwards compatible with ls.

delta

A viewer for git and diff output

dust

A more intuitive version of du written in rust.

duf

A better df alternative

broot

A new way to see and navigate directory trees

fd

A simple, fast and user-friendly alternative to find.

ripgrep

An extremely fast alternative to grep that respects your gitignore

ag

A code searching tool similar to ack, but faster.

fzf

A general purpose command-line fuzzy finder.

mcfly

Fly through your shell history. Great Scott!

choose

A human-friendly and fast alternative to cut and (sometimes) awk

jq

sed for JSON data.

sd

An intuitive find & replace CLI (sed alternative).

cheat

Create and view interactive cheatsheets on the command-line.

tldr

A…

Collapse
 
anishde12020 profile image
Anish De

Thanks for sharing!