Terminal + ZSH

Anh-Thi Dinh
A collection of console terminals in serveral operation systems.
👉 Note: Bash (Unix Shell)

Terminals

Windows

Install cmder (drop-down by Ctr + \) and I use this personal setting files.
👉 Note: WSL 2 on Windows

Linux

  • Install Zsh, check the previous section.
  • Save/Restore settings:
    • 1# save settings
      2guake --save-preferences ~/Downloads/guake_prefs
      3# load settings
      4guake --restore-preferences ~/Downloads/guake_prefs

MacOS

👉 Using iTerms2. Download its settings.

Zsh (MacOS)

1# CLI tools for Xcode
2xcode-select -r
3xcode-select —-install
4
5# install hombrew
6/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/master/install.sh>)"

Zsh

👉 Read more WSL 2 on Windows

Install Zsh + oh-my-zsh

1# check is installed
2zsh --version
1# install (linux)
2sudo apt install zsh
3
4# install (macos - integrated)
1# make zsh default bash
2chsh -s $(which zsh) # log out & log in
1# check
2echo $SHELL # /bin/zsh  or similar
1# install oh-my-zsh
2sh -c "$(curl -fsSL <https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh>)"

Plugins

After installing plugins, put them in ~/.zshrc
1plugins=(git docker docker-compose zsh-syntax-highlighting dnf npm)
2# for me
3# plugins=(git docker docker-compose npm ruby python emoji)

spaceship-prompt theme

This is my choice. Source code. More settings can be found here. You need to install oh-my-zsh first!
1git clone <https://github.com/denysdovhan/spaceship-prompt.git> "$ZSH_CUSTOM/themes/spaceship-prompt"
1ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
Set ZSH_THEME="spaceship" in your .zshrc.

Fonts

Install font Source Code Pro:
Powerline font,
1sudo apt-get install fonts-powerline
In terminal, choose the corresponding installed fonts.
Add alias to ~/.zshrc (search "alias" to find the place to put).

Display execution time below to command

The following tip will display the execution time of a command. This can be useful, especially when you execute the same command multiple times and need to know when the last command was executed.
1# Push below in .zshrc
2preexec () {
3  local TIME=`date +"[%H:%M:%S] "`
4  local zero='%([BSUbfksu]|([FK]|){*})'
5  local PROMPTLEN=${#${(S%%)PROMPT//$~zero/}}
6  echo "\033[1A\033[$(($(echo -n $1 | wc -m)+$PROMPTLEN))C $fg[blue]${TIME}$reset_color"
7}

Other plugins

  1. fzf -- search in terminal. (Use: fzf)
 
Loading comments...