Skip to main content

tag: cli

Categories
General

Utility tools to boost your command line experience

If you are a programmer, you may spend a good amount of time on the command line. Here is a small set of utility tools which have helped me.

bat command

You may have come across the cat command, which helps you in viewing the contents of a file.

cat command preview

It certainly is very helpful, but what if we could make it better? Enter the bat command, or as described on its repository A cat(1) clone with wings.

The command really does add wings to the cat command, bat supports syntax highlighting for a large number of programming and markup languages, integration with git and automatic paging if the content doesn’t fit on your screen, here is a preview of the command.

bat command preview

Installation instructions can be found here, take it on a test drive! If you find this useful, you can alias the bat command for cat and make it your default way of viewing file contents.

Overriding the cat command using alias :

alias cat='bat'

fzf fuzzy finder

If you are lazy and looking to run commands you ran earlier but don’t exactly recall the exact usage, you must have done a Ctrl+R to search through history, fzf enhances this and gives you a preview, here is the command in action.

fzf preview

Installation instructions can be found here, you can also use fzf to preview files in a directory by combining it with bat, for a quick preview.

Alias for fzf + bat preview :

alias preview="fzf --preview 'bat {}'"

fzf + bat alias preview

That’s about it for now, I hope this helps!