Shell

bash basics

default text editor

echo "export VISUAL=nano\nexport EDITOR=nano" >> ~/.bashrc
echo "export VISUAL=nano\nexport EDITOR=nano" >> ~/.zshrc

sudo sh -c "echo -e \"export VISUAL=nano\nexport EDITOR=nano\" >> ~/.bashrc"
sudo sh -c "echo -e \"export VISUAL=nano\nexport EDITOR=nano\" >> ~/.zshrc"

login message:

add for example:

#shell login message
echo -e "\n\n You are working on: \t\e[41m>>> subdomain.my-server.com <<<\e[49m\n\n"

custom shell prompt:

add for example:

#shell login message
alias PS1="\e[0;32m[\u@\h \w]\$ \e[0m"

[test@ubuntu1 ~]$ <- in green

PS3 for select prompt

https://www.thegeekstuff.com/2008/09/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command/

Terminal colors

The first number in the color code specifies the typeface:

The second number indicates the color you want:

color background text
black \e[0;40m \e[0;30m
Red \e[0;41m \e[0;31m
Green \e[0;42m \e[0;32m
Brown \e[0;43m \e[0;33m
Blue \e[0;44m \e[0;34m
Purple \e[0;45m \e[0;35m
Cyan \e[0;46m \e[0;36m
Light gray \e[0;47m \e[0;37m

output redirection

          || visible in terminal ||   visible in file   || existing
  Syntax  ||  StdOut  |  StdErr  ||  StdOut  |  StdErr  ||   file   
==========++==========+==========++==========+==========++===========
    >     ||    no    |   yes    ||   yes    |    no    || overwrite
    >>    ||    no    |   yes    ||   yes    |    no    ||  append
          ||          |          ||          |          ||
   2>     ||   yes    |    no    ||    no    |   yes    || overwrite
   2>>    ||   yes    |    no    ||    no    |   yes    ||  append
          ||          |          ||          |          ||
   &>     ||    no    |    no    ||   yes    |   yes    || overwrite
   &>>    ||    no    |    no    ||   yes    |   yes    ||  append
          ||          |          ||          |          ||
 | tee    ||   yes    |   yes    ||   yes    |    no    || overwrite
 | tee -a ||   yes    |   yes    ||   yes    |    no    ||  append
          ||          |          ||          |          ||
|& tee    ||   yes    |   yes    ||   yes    |   yes    || overwrite
|& tee -a ||   yes    |   yes    ||   yes    |   yes    ||  append

zsh

all in one script

if test -f ~/.zshrc; then
  echo "Installing zsh with oh my zsh and powerlevel10kTheme"

  sudo apt update && sudo apt install curl git zsh
  sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
  git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  sed -i '/ZSH_THEME="/c\ZSH_THEME="powerlevel10k/powerlevel10k"' ~/.zshrc
fi

To customize prompt, run p10k configure or edit ~/.p10k.zsh.

install zsh

Oh My Zsh Cheatsheet

install powerlevel 10k theme
edit for visual studio code

terminal emulator

terminator

documentation

Created 2022-10-29 22:37:16 UTC by Daniel Raab
Updated 2025-11-01 23:13:24 UTC by Daniel Raab