mikelindner.com

powering the Internet since 1995

| Photography | Computing | Cooking |

Shell Fun

December 2nd, 2019

I love the Linux shell – it’s one of the top reasons to use Linux.
This post lists some geeky additions to make your shell an absolute joy to live in.

 

zsh
When I first heard that MacOS was moving to zsh I rolled my eyes. Apple’s bash is truly appalling so it sounded like putting lipstick on a pig. Now that I’ve tried it for real (on Linux) I can see it’s really quite an awesome shell and I’ve been converted.

Warning: There does seem to be a bug in the up-arrow history, it forgets where the string starts or something… this might just be my machine, but look out for it and if it bugs you too much just revert to bash.

Getting started is simple, although wait until you’ve got Oh My ZSH! running for some real leetness…

sudo apt install zsh

Once you have this installed add the following string to the end of your .zshrc file:

PROMPT="$fg[cyan]%}$USER@%{$fg[blue]%}%m ${PROMPT}"

This will give you the username/host/pwd you’re used to in bash.

Finally change your default shell to be zsh

sudo usermod -s /bin/zsh `whoami`

 

Oh My ZSH!

I don’t know why they called it this, but that can be said for a lot of projects.  Silly name, awesome results (looking at you Gimp)

Oh My ZSH is a framework that allows people to contribute plugins for various commonly used packages.  Git is the most obvious one, it allows autocomplete of git commands, as well as changing the prompt to let you know what branch you’re in.  Way too much more to go into here, have a look yourself, and trust me – you want this 😉

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

At this point log out and log back in again.

 

figlet

Figlet is a handy little program for when you want to expand text, such as hostnames on login.

sudo apt install figlet

Popping out a word is simple:

You can also pipe other commands through it:

And using lolcat (see the next post) you can really change things up!