SuperCharge Your Linux Terminal Experience Part-2

How to improve your Linux terminal experience.

Agrover112
CodeX
5 min readApr 3, 2023

--

A beautiful density plot

In this Second part to the series of improving our Linux terminal experience we will discuss some awesome tools to improve our productivity on the commandline!

Speedread

Tired of using cat or less or opening the entire file using vim , and just want to glance through the file content quickly? Speedread is here to help. This command-line tool is great for the voracious readers out there. With simple arguments one can read an entire file quickly.

To Install simply clone the GitHub repository and place it wherever you want:

git clone https://github.com/pasky/speedread
# Place it in a folder such as Downloads

After cloning simply add an alias for speedread in ~.bash_aliases or by add it permanently to the $PATHenv variable.

# Inside ~.bashrc or ~.zshrc
export PATH="$HOME/meow/Downloads/speedread/speedread:$PATH"

Simply press SPACEBAR to pause and display last 2 lines.

Use [ to slow down the Words Per Minute(wpm) or ] to increase the words per minute easily.

Pressing Spacebar pauses it up.

Easily change the wpm using the following command:

speedread filename -w 120 #wpm
-w changes the words per minute

youplot

What if one could make pretty plots from the command-line itself ? then youplot is the answer! I have longed to have a good plotting library for the command-line. And I would say this is one of the best plotting libraries I have used. It’s plots are simply beautiful and will be my go-to plotting library from the command-line.

To Install you need to have gem package manager from Ruby.Following the commands below:

sudo apt update
sudo apt install ruby # If you do not have ruby insalled

# After properly installing gem

gem install youplot

Now, I’m going to show how I can visualize a Lexicon file as a bar plot of the number of most occuring phonemes:

In order to do that we first convert the lexicon file into a file which groups together the unique phonemes and it’s respective frequency:

cat lm/librispeech-lexicon.txt | awk '{print $3}' |\
tr ' ' '\n' |\
sort | uniq -c | sort -n |\
awk '{print $2 " " $1}' > ~/phoneme_counts.txt
sed 's/ /  /g' phoneme_counts.txt > phoneme_counts.tsv

The .tsv file has 2 columns 1st column with phoneme symbol and the 2nd column with its frequency. We convert to .tsv because that’s the reccomended file format.

After this let’s plot the file:

sort -k2 -nr phoneme_counts.tsv | head -n 20 | uplot bar -t "20 most occuring phonemes in Librispeech"
Bar plot of 20 most commonly occuring phonemes

Another wonderful example is to plot the famous IRIS dataset. The IRIS dataset contains 4–5 columns and we chose to take only 3 columns whose headers are then used for plotting:

curl -sL https://git.io/IRIStsv \
| cut -f1-4 \
| uplot scatter -H -t IRIS
A scatter plot of IRIS dataset.

Difftastic

Difftastic is fantastic.Our obsession with different Diff tools doesn’t change even after using many variants of diff such as colordiff ,vimdif,etc. Though I believe I might have finally settled upon this one. It’s the most readable diff tools I have used and comes closest to how Visual Studio shows the Diff.

To install this package you do require brew which can be installed by following the instructions mentioned here/here. To install:

brew install difftastic
difft --language bash old_file.bash new_file.bash
Comparing two Bash files

One can also set Difftastic as the external diff tool for git by:

# Set git configuration for the current repository.
git config diff.external difft
OR
# Set git configuration for all repositories
git config --global diff.external difft
git diff

One can view the diff in the log with the following command:

or for a specific commit using:


git log -p --ext-diff # To view entire log with diff

git show 3123a123bvjk1235vk --ext-diff
Difftastic with git log

btop

Another day another new linux process visualizing tool.

Btop++

I love btop because it’s so much more friendly , supports different themes such as Dracula, solarized dark and to top it off support for Vim key bindings.

htop on steriods

mcfly

Mcfly is one of those tools that is wonderful for a variety of reasons. It not only provides a visual way to look at my history by replacing CTR- R key-binding with itself but also providing a utility where a simple feedforward neural-net written in rust from scratch can be used for better predicting our histories.

If you have brew install you can install mcfly by using these commands:

brew tap cantino/mcfly
brew install cantino/mcfly/mcfly
# Use command which matches your shell type: Bash/Zsh/Fish

eval "$(mcfly init bash)"

#eval "$(mcfly init zsh)"

#mcfly init fish | source

After this simply activate it by running :

. ~/.bashrc #Bash
~/.zshrc # ZSH
~/.config/fish/config.fish # Fish shell

To use mcfly search one can either use the key binding CTRL -R or type

mcfly search

For training this auto-suggestion engine simply run following command:

mcfly train
A 3 node neural network in Rust within Mcfly
mcfly training process

The trainer then trains a simple neural net with 2/3 nodes and calculates the error using Gradient Descent for optimizing with Backpropogation which are actually fairly simple for non-matrix representation case. (For more information)

Feel free to follow up with your idea on Twitter @agrover112, for taking on the Herculean task to change my mind.

Join my email list for more helpful insights on tech and non-tech !

--

--

Agrover112
CodeX

Tech enthusiast sharing insights on coding, education, and personal growth. Explore my blog to learn from my experiences and find new ideas in the world.