My Terminal - the main tool

The terminal is where I spend most of my day. My main tools are alacritty, iTerm2, zsh, tmux and then neovim. They are riced and have a number of plugins.‌‌

My Terminal - the main tool
Photo by Pakata Goh / Unsplash

The terminal is where I spend most of my day. My main tools are alacritty, iTerm2, zsh, tmux and then neovim. They are riced and have a number of plugins.‌‌ I'm along time friend of Alacritty and Z shell. I also use tmux for some repetitive work on multiple servers or VM's, like updates. Sometimes I just switch on a green on black nostalgic team or amber on black for tmux with a 4 pane window to simulate the old IBM SysAdmin terminals.

I do add plugins and rice the terminal to my liking - of the time. ‌‌My current is Oh My Zsh, PowerLevel10K theme and as my plugins: zsh-autosuggestions (my favorite), syntax-highlighting, sudo, web-search.

For some work a have neovim, this post will not cover nvim.

Prepare for installation

  • Linux: You should have git, curl and/or wget and zsh installed
    apt update && apt install -y git curl wget zsh
  • On some Linux systems you need to set zsh as the default terminal
    chsh -s /bin/zsh user-id
  • Mac: You need to have Homebrew, iTerm2 and git installed
    - Install Homebrew
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    - Add Homebrew to the path
    `echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/[username]/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

    - Install iTerm brew install --cask iterm2
    - Install git brew install git

Install Oh My Zsh

It's straight forward using curl or wget. See the documentation for more details, link at the end of the post.

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

Now, oh-my-zsh is installed in your home directory '~/.oh-my-zsh'.

Open your terminal and run the setup.

Terminal font is set to "MesloLGS NF" I tend to change to the slimmer "JetBrains Mono". Remember to use Nerd Fonts.

Next step is to setup addons and choose a theme.

Auto update of OMZ

OMZ has an automated update you can set on or off by the line:‌‌nano .zshrc and in there you will find a line # DISABLE_AUTO_UPDATE="true"

The full choice of style options is available only when using Nerd Fonts.

Configur OMZ

You need to run the configurator, starts at first start of the terminal.
Manual start of config p10k configure

Plugins for Oh My Zsh

These are my choices out of a insane number of plugins

zsh-autosuggestions

You need to install the zsh-autosuggestions first, check on the GitHub.

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins):
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

2. Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc) like this plugins=( # other plugins... zsh-autosuggestions )

3. Restart zsh

Zsh syntax highlighting

  1. Clone this repository in oh-my-zsh's plugins directory
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

2. Activate the plugin in ~/.zshrc like this plugins=( [plugins...] zsh-syntax-highlighting)

3. Restart zsh

Add all the plugins

This is my config for plugins today

plugins=(git zsh-autosuggestions zsh-syntax-highlighting web-search sudo tmux)

Other plugins can be found here

Themes for Oh My Zsh

I love the Powerlevel10k theme. Install by

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
nano .zshrc
Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

Homebrew

brew install romkatv/powerlevel10k/powerlevel10k
echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc

Arch Linux

yay -S --noconfirm zsh-theme-powerlevel10k-git
echo 'source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc

Other themes can be found here and all over GitHub


-

TMUX the terminal multiplexer

tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.

Install apt install tmux A guide on how to install can be found in this link.

When tmux is started, it creates a new session with a single window and displays it on screen. A status line at the bottom of the screen shows information on the current session and is used to enter interactive commands.

tmux may be controlled from an attached client by using a key combination of a prefix key, ‘C-b’ (Ctrl-b) by default, followed by a command key.

Key bindings may be changed with the bind-key and unbind-key commands.

I recommend to re-configure the key bindings ‘C-b’ isn't that ergonomic.

Other automation

I run a set of scripts to do many tasks like ssh as root is sshr and then the last octet sshr 55 is a short for ssh [email protected] . The use of aliases is a key to boost performance. A large collection is in the BashAddon.sh script, it's a rolling release.

Download with wget and read the scripts

A more modern ls-command exa

Install apt install exa . Examples of usage exa instead of ls : exa --long --icons and with a tree exa --long --icons --tree

IPcalc

To calculate your subnets IPv4 and IPv6 can be messy. This is a easy tool to use and its available on most distros and win.


Other things to do

If you use VSCode

Update the Terminal Font by open settings.json and add this line:
"terminal.integrated.fontFamily": "MesloLGS NF"

Increase iTerm2 Font Size

  1. Open iTerm2 preferences
  2. Go to Profiles > Text
  3. I increase my font size to 18 or 20px

Change iTerm2 color schemes

You can find plenty of themes here: iTerm2 Color Schemes and also the installation instructions.

Change Alacritty color schemes

Copy the theme content from GitHub and paste the content to your config file, alacritty.yml ( see original on GitHub alacritty config file).

Docker

Install Zsh, Oh-My-Zsh and plugins inside a Docker container with one line! Default powerline10k theme, no plugins installed Link to the GitHub

RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.1.5/zsh-in-docker.sh)"

Try Powerlevel10k in Docker. You can safely make any changes to the file system while trying out the theme. Once you exit Zsh, the container is deleted. Install needed fonts first.

docker run -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -it --rm alpine sh -uec ' apk add git zsh nano vim git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k echo "source ~/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc cd ~/powerlevel10k exec zsh'

Muon SSH

I also have Muon (former Snowflake) as a Terminal and SFTP browser.

Muon is a graphical SSH client. It has a enhanced SFTP file browser, SSH terminal emulator, remote resource/process manager, server disk space analyzer, remote text editor, huge remote log viewer and lots of other helpful tools, which makes it easy to work with remote servers. Muon provides functionality similar to web based control panels but, it works over SSH from local computer, hence no installation required on server. It runs on Mac, Linux and Windows.



References

The home of Oh My Zsh is on GitHub, please visit and give them a star [1]
Powerlevel10k them [2] Autosuggestions Installation documentation [3] Syntax Higlighting [4] Find more plugins [5] Archlinux wiki on Z shell [6]
The terminal multiplexer tmux. [7]
exa is a modern version of the ls command [8]
neovim is a hyperextensible Vim-based text editor [9]
ipcalc is a cli calculator for IPv4 and IPv6 addresses [10]
Muon SSH Is a Terminal and a ToolBox app [11]


  1. Oh My Zsh home page at GitHub on the web see plugins see themes ↩︎

  2. Powerlevel10k on GitHub ↩︎

  3. Installation help for zsh-autosuggestions is on GitHub ↩︎

  4. Installation help for zsh-syntax-highlighting is on GitHub ↩︎

  5. Top popular Zsh plugins on GitHub (2023) webpage ↩︎

  6. For Archlinux users see this wiki ↩︎

  7. More info on tmux can be found on the GitHub wiki includs a Getting stated guide a install guide and manual ↩︎

  8. The modern exa is a ls on steroids. See this page on GitHub ↩︎

  9. See neovim's homepage for details and documentation ↩︎

  10. See ipcalc on GitHub for info or use it online page ↩︎

  11. Muon SSH see the GitHub page with wiki page ↩︎