loading...

Make your Terminal Sassy !

sona_ profile image Sonali ・4 min read

Recently a few people asked me about my colorful terminal. So I decided to write a quick article about it. If you like what you see then scroll down.

Screen Shot 2020-10-12 at 2.03.16 PM

Here are easy to follow steps to make your terminal "SaSsY" like mine ;)

1) https://www.iterm2.com

download this

2) Install homebrew

 % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

3) Download ohmyzsh framework

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

4) Run brew install httpie.

This is a commandline http-client with a cool UI, syntax highlighting, JSON support & many more features & I use it instead of graphical programs like Postman Ref: https://httpie.org/docs#installation

5) Run brew install htop.

It's a pretty cool interactive process viewer. Ref: https://htop.dev. After installing you can run the command htop

6) For the js folks brew install node.

Then you can check your node version using node -v & npm version using npm -v. You can also look into nvm which is a node version manager to easily switch between differnt node versions.

7) Run npm install -g tree-cli.

This will list the content of directories in tree like format when you run the command tree
Ref: https://github.com/MrRaindrop/tree-cli

9) Make vim pretty

If you would like a colorful vim editor then do this:
vi ~/.vimrc and add syntax on
If you'd always like to see line numbers then add set number in your vimrc

8) Configuring zshrc

1. To configure zsh

you need to customize somethings inside zshrc so run this command vi ~/.zshrc

2. Theme

The name of the theme I use is "Jonathan". So far I like it. You can search for the following in your zshrc ZSH_THEME and set it to whichever theme you like.

3. Plugins:

I use the following plugins. Find plugins in your zshrc & add the name of the plugins like this.

    plugins=(
        git
        zsh-autosuggestions
        zsh-syntax-highlighting
    )

But for those plugins to work you need to first clone them so run the following commands:

  • zsh-autosuggestions
    This is a super handy plugin for auto suggestions. It suggests commands as you type based on history and completions.
    Ref: https://github.com/zsh-users/zsh-autosuggestions

    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    
  • zsh-syntax-highlighting
    Provides some cool syntax hylighting.
    Ref: https://github.com/zsh-users/zsh-syntax-highlighting

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    
4. thefuck - Yes, thefuck ? you read it right!

It's fine friends, we all use bad words sometimes(jk), sometimes though :P!
This one corrects errors in previous console commands. So let's say you type pd instead of pwd (eyeroll) , it's obviously an invalid command. So all you gotta do is type "fuck" and it would tell you what went wrong.
I'm still exploring this one, it's not super accurate but for now I like it.
To get this to work, inside your zshrc copy the following
eval $(thefuck --alias)
Ref: https://github.com/nvbn/thefuck
Here's what it looks like
Screen Shot 2020-10-12 at 1.20.32 PM

5. Let's talk about colors ..

For this one, go to Preferences -> i-term -> profiles -> Colors. I changed the font to be Chalkduster and set a different color as well. Here is my config:
Screen Shot 2020-10-12 at 1.20.12 PM

9) Now, let's get into the coolest part ;) ft. ASCII art , lolcat , cowsay

  • ASCII Art

I created my funky ASCII name art using this tool

https://dev.to/lakatos88/ascii-themes-node-js-cli-interface-to-generate-themed-ascii-art-4ck8

but if you do not want to go through those steps, you can always create your own art using this tool & copy paste it. http://www.patorjk.com/software/taag/#p=display&f=Patorjk-HeX&t=SONA

I created a file called welcome.sh & copy pasted the design there. Make sure you put each line in an echo "your ascii" command . Checkout the screenshot.
Screen Shot 2020-10-12 at 1.44.09 PM

I then put this ./welcome.sh at the end of my zshrc file.

  • lolcat

If you like rainbow effects then run brew install lolcat. If you want to apply this rainbow effect to your welcome message then in your zshrc add this at the end of the file
./welcome.sh | lolcat

  • fortune & cowsay

If you would like a random quote by a cow and want all of that in rainbow colors then
brew install fortune and brew install cowsay and then again go back to the end of your zshrc and after the welcome message add the following fortune | cowsay | lolcat

Pls Note: for all the above changes to take effect, run source ~/.zshrc or restart your terminal.
Yes, your terminal is going to look absolutely beautiful after all this!

10) Aliases

Aliases are super helpful & you can add that in your zshrc as per your use-case & convenience. I wanted the lolcat effect for a few commands so I added the following aliases with lolcat in my config

alias ls='ls | lolcat'
alias pwd='pwd | lolcat'
alias gs='git status | lolcat'
alias tree='tree | lolcat'

I hope this was helpful!

If you would like to share cool tricks with "lolcat" or anything else, I would love to hear from you!

Also, on our medium blog:

https://medium.com/just2girlsintech/make-your-terminal-sassy-776465b1becd

Discussion

pic
Editor guide