A collection of console terminals in serveral operation systems.
πΒ Note: Bash (Unix Shell)
Only for macOS (Windows/Linux isnβt checked yet)
1Ctrl+A # go to the beginning of line
2Ctrl+E # go to the end of line
3Option+Left # back one word
4Option+Right # forward one word
5Ctrl+U # remove the entire line containing the cursor
6Ctrl+K # delete from cursor to end of line
7Crtl+W # delete a word backward (left of cursor)
8Alt+D # delete a word forward (right of cursor)
π Note: WSL 2 on Windows
- Install Zsh, check the previous section.
π Using iTerms2. Download its settings.
Remember the last command lines for each project
(MacOS) Install Homebrew first.
π Read more WSL 2 on Windows
On MacOS, Zsh is already installed and default.
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
Install oh-my-zsh.
Install below plugins (using oh-my-zsh way) first:
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)
Install using oh-my-zsh way: check here:
Set
ZSH_THEME="spaceship"
in your .zshrc
.Install font Source Code Pro:
- Install
wget
andfontconfig
first using brew
1brew install wget
2brew install fontconfig
- Follow instruction here (step 1-4). If some folders don't exist, create them!
- Install Source Code Pro for Powerline and then
1fc-cache -f -v
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).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}
- fzf -- search in terminal. (Use:
fzf
)
Β