DEV Community

Cover image for My terminal became more Rusty 🦀
Mahmoud Ashraf
Mahmoud Ashraf

Posted on • Updated on • Originally published at mahmoudashraf.dev

My terminal became more Rusty 🦀

Originally Published on my blog

As a Software-Engineer I spent most of the time inside my terminal, So
I need for that a fast terminal with fast tools to speed up my productivity.

The tools written in rust help me to achieve that. let's see in this article
these tools.

tl;dr

  • alacritty A cross-platform, GPU-accelerated terminal emulator
  • starship 🌌 The minimal, blazing-fast, and infinitely customizable prompt for any shell!
  • exa A modern version of ‘ls’.
  • bat A cat(1) clone with wings.
  • delta A viewer for git and diff output
  • zoxide A faster way to navigate your filesystem
  • ripgrep ripgrep recursively searches directories for a regex pattern
  • fd A simple, fast and user-friendly alternative to 'find'
  • bottom Yet another cross-platform graphical process/system monitor.
  • tldr 📚 Collaborative cheatsheets for console commands
  • spotify-tui Spotify for the terminal written in Rust 🚀
  • gitui Blazing 💥 fast terminal-ui for git written in rust 🦀

Alacritty

Let's start our list with alacritty terminal is one of the fastest terminals
because of using GPU for rendering, and it is a cross-platform terminal.

You can customize your own configuration like color scheme, fonts, opacity, and key mapping.

Alacritty doesn't come with ligature support but you can use
this fork. or if
you are using Arch you can install it from aur

Screenshot of the terminal showing alacritty ligatures


Starship

I used to use zsh + powerlevel9k as my prompt and even when I migrate to powerlevel10k, I still
notice a delay when open new shell. But with starship it's start instantly.

You can use it with any shell bash, zsh, fish and even powerShell.

The screenshot below showing the result of my customized configuration.

screenshot of starship prompt


Exa

exa is an implementation of ls command but with colors and icons and it renders very fast.

I'm using exa as replacer for ls command by making an alias.

if [ "$(command -v exa)" ]; then
    unalias -m 'll'
    unalias -m 'l'
    unalias -m 'la'
    unalias -m 'ls'
    alias ls='exa -G  --color auto --icons -a -s type'
    alias ll='exa -l --color always --icons -a -s type'
fi
Enter fullscreen mode Exit fullscreen mode

the result of my ls and ll commands.

screenshot of exa result


Bat

Bat is an implementation for cat command but with syntax highlighted.

Also I make an alias for this command with nord theme.

if [ "$(command -v bat)" ]; then
  unalias -m 'cat'
  alias cat='bat -pp --theme="Nord"'
fi
Enter fullscreen mode Exit fullscreen mode

screenshot of bat


Delta

delta enhance your git diff output by adding some cool features like syntax highlighting,
line numbering, and side-by-side view.

to make delta works in your .gitconfig file add:

[core]
  pager = delta
[interactive]
  diffFilter = delta --color-only
[delta]
  side-by-side = true
  line-numbers-left-format = ""
  line-numbers-right-format = "│ "
  syntax-theme = Nord
Enter fullscreen mode Exit fullscreen mode

we set delta as the default pager for git commands output and enable side-by-side
feature and set a theme for Nord, You can choose your preferred theme run and choose one.

delta --list-syntax-themes
Enter fullscreen mode Exit fullscreen mode

screenshot of delta


Zoxide

I don't use any file explorer, I just use cd command to navigate between the files and ls command.

I have a projects directory on my home directory if I wanna navigate to a project of these projects.
I will write

cd ~/projects/mahmoudashraf.dev
Enter fullscreen mode Exit fullscreen mode

instead I will write

z ~/projects/mahmoudashraf.dev
Enter fullscreen mode Exit fullscreen mode

just in the first time and if I wanna navigate again to this directory from anywhere
just write

z mah
Enter fullscreen mode Exit fullscreen mode

Ripgrep

It is a cross-platform command line searches your directory for a regex pattern.

I recommend you read this article ripgrep is faster than {grep, ag, git grep, ucg, pt, sift}
.

some commands that i'm using

# search on javascript files for specific regex
rg tjs "import React"

rg "\.content" -g "*.pug"

Enter fullscreen mode Exit fullscreen mode

screenshot of ripgrep


Fd

the friendly version of find command, and faster.

It's by default ignore .gitignore file

in this tutorial I have some screenshots in png format to convert them all to jpg:

fd -e png -x convert {} {.}.jpg
Enter fullscreen mode Exit fullscreen mode

To delete files

fd -H '^\.DS_Store$' -tf -X rm
Enter fullscreen mode Exit fullscreen mode

bottom

In this time not top 😀 it is bottom

it's a cross-platform system monitor.

screenshot of bottom


Tldr

tldr is a cheatsheets for CLIs, instead of read the whole man.

screenshot of tldr


More Tools?

  • for who want lightweight alternative for spotify client you can use spotify-tui.
  • also if you prefer an UI interface for git check gitui.

and there is a ton of CLIs and tools written in rust you can check
lib.rs/command-line-utilities.



Top comments (28)

Collapse
 
vonheikemen profile image
Heiker

Cool. Now all you need is a rusty interactive shell. Have you heard about nushell?

Collapse
 
himujjal profile image
Himujjal Upadhyaya

I was going to comment about nushell! And to my surprise its the first comment. nushell is out of this world. Unlike JavaScript and Python this will be an actual scripting language. Concise and fast.

Then I guess we will have two kinds of programming languages:

  1. Statically typed -> AOT compiled
  2. NuShell / Powershell
Collapse
 
22mahmoud profile image
Mahmoud Ashraf

Yeah I tried nushell before, it's pretty nit. but since zsh compatible with all bash commands and fast, i don't have a reason to go nushell.

Collapse
 
romkatv profile image
Roman Perepelitsa

I used to use zsh + powerlevel9k as my prompt and even when I migrate to powerlevel10k, I still notice a delay when open new shell.

Powerlevel10k has a feature called Instant Prompt. Once you enable it, zsh will start instantly even if your .zshrc loads a dozen of slow plugins. AFAIK, Powerlevel10k is the only theme that can effectively reduce zsh startup time to zero without invasive changes to your configs.

As far as prompt speed goes (that is, the lag or absence thereof after every command), Powerlevel10k is currently significantly ahead of Starship. See github.com/starship/starship/discu....

Collapse
 
22mahmoud profile image
Mahmoud Ashraf

it's seems interesting, I'll give powerlevel10k another try.

Collapse
 
rhymes profile image
rhymes

I use exa, bat, delta, zoxide, fd and my absolute favorite of them all: ripgrep. I'll check the others out. Thank you Mahmoud!

Collapse
 
samicooo profile image
Abdullah Tayel

I actually never searched for a spaceship prompt faster alternative, and had reverted back to minimal. Thanks for the heads up will definitely be using starship.

You have like the exact setup I have but I still prefer iterm2 than alacrity on macOS, but yea on windows alacrity definitely wins for me.

Collapse
 
coreyja profile image
Corey Alexander

Ohh I didn't realize someone had a form of Alacritty with ligatures! That's super interesting! Will have to check that out!
I want to use a ligature font more but the Alacritty support has been holding me back

Collapse
 
harishav profile image
harishav

When i am trying to setup bat in my macos system, i have added the snippet you have provided in the .bash_profile file, i am getting below error whenever i open my terminal.

-bash: unalias: -m: invalid option
unalias: usage: unalias [-a] name [name ...]

Can someone help what's missing

Collapse
 
22mahmoud profile image
Mahmoud Ashraf

use -a instead of -m in the bash

Collapse
 
harishav profile image
harishav

Thanks for quick response, will give it a try.

Collapse
 
abdurrkhalid333 profile image
Abdur Rehman Khalid

I work on the KDE Neon Plasma and Its terminal is simple black and white and there is nothing attractive and colorful about it. Thank you very much for taking some time and writing this cool and amazing post.

From all the above suggestions, I will be using Starship as it looks very simple and cool.

Collapse
 
raguay profile image
Richard Guay

How about ion! It's really fast.

Collapse
 
katafrakt profile image
Paweł Świątkowski

Here I am, using at least half of these, not knowing they are written in Rust (except ripgrep) ;)

Collapse
 
heytimapple profile image
Tim Apple • Edited

You may as well use Nu shell also..
nushell.sh/

Collapse
 
hemant profile image
Hemant Joshi

How do you design your terminal?

Are you using default Os terminalmor someother?

Please suggest me some good terminal design topics and ways and lot of ideas☺️

Thank you.

Collapse
 
22mahmoud profile image
Mahmoud Ashraf

you can check my dot config files

and you can get more inspirations from r/unixporn

Collapse
 
weakish profile image
Jang Rush

Hi, I'd like to translate this rusty post to Chinese. Can you give me the permission?

Collapse
 
22mahmoud profile image
Mahmoud Ashraf

sure

Collapse
 
weakish profile image
Jang Rush

Chinese translation published on last weekend: nextfe.com/rusty-terminal/

There is a backlink to this original post at the beginning of the translated text.

Collapse
 
igas profile image
Marcus Wood

Great post! Although tldr is not written in rust, you probably want github.com/dbrgn/tealdeer which is a compatible client in rust

Collapse
 
bjtitus profile image
Brandon Titus

I really like gitui's navigation compared to tig's out of the box. Thanks for these!

Collapse
 
dvg3012 profile image
dvg3012

Hey, check out github.com/hrkfdn/ncspot

It's a lightweight spotify client for the cli. It's amazing and I use it daily(+ written in rust :D).