JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

Shells: Zsh & Oh-my-zsh. Aliases. Fish.

Play around with your command shell, and you’ll be surprised at how much more productive it makes you, The Pragmatic Programmer

Unix shells are interactive interfaces that allow users to interact with the Operating System by executing commands and utilities. There are three main shells: bash, Zsh, and fish.

All you need is #!/bin/bash

All you need is #!/bin/bash

Z shell

Some features: If you want to change directory, it is not necessary to enter the cd command (automatic cd), i.e. Documents instead of cd Documents and you don’t have to type whole directory names either, ls Dro/do/Ba(<Tab>) becomes Dropbox/docs/Basic. tree -<Tab> suggest a list of options for tree, with short descriptions, ls **/Linux.md performs a recursive search and returns Dropbox/docs/Linux.md

  1. Installation: brew install zsh zsh-completions (macOS), sudo apt install zsh && sudo apt-get install powerline fonts-powerline (Ubuntu), sudo pacman -S zsh zsh-completions powerline powerline-fonts (Arch)
  2. Check the Zsh version by typing zsh ‐‐version
  3. Set zsh as the default shell. Make sure that zsh is installed and is an accepted shell: $ cat /etc/shells, then make it your default shell by using chsh -s $(which zsh) or chsh -s $(which zsh) username. After that, you need to log out, then log back in for the changes to take effect. Don’t worry, you can always revert to Bash by typing: chsh -s $(which bash).
  4. First run. When you first open a terminal, you’ll be greeted by the Z Shell configuration function for new users with a menu. Select 2, Populate your ~/.zshrc with the configuration recommended by the system administrator and exit.
    sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

After editing the configuration file for Z shell, you need to either start a new shell instance or type: source ~/.zshrc to apply the changes you have just made. Next time, you could use the alias “szsh”. zsh



Aliases are essentially shortcuts, a means of avoiding typing or remembering a long command sequence that you use often.

# My aliases
# Edit Zsh's configure file
alias ezsh="atom $HOME/.zshrc" 
# Reload Zsh
alias reload='source ~/.zshrc'
# Find my IP address
alias myip='curl http://ipecho.net/plain; echo'
# Atom crashes upon launch, it works with --no-sandbox
alias atom='atom --no-sandbox'
# It selects a random fortune from my quotes collection.
alias fortune='fortune ~/.config/myquotes/quotes'
alias ll='ls -alF'
# Replace ls with exa
alias ls='exa --long --header --git'
# Replace cat with bat
alias cat='bat --style=plain'

If you want to know more about cat, exa, fzf, youtube-dl, and ripgrep, read our article Awesome command linux tools: bat, fzf, exa, ripgrep, youtube-dl.

# df -h reports file system disk usage with human-readable sizes.
alias df='df -h'  
# free displays the total amount of free and used memory in the system in MB
alias free='free -m' 
# This aliases help you to switch between shells
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
# Use: ytmp3 url. It downloads a YouTube video to the ~/Music folder.
ytmp3() { cd ~/Music; youtube-dl --extract-audio --audio-format mp3 "[email protected]"; }
# Edit i3's configuration file
alias ei3='atom ~/.config/i3/config'
# Launch ferdi
alias ferdi='./AppImages/Ferdi-5.8.0.AppImage'
alias radio='curseradio'
# Preview and edit files using [fzf](/software/fzf-bat/)
alias preview="fzf --preview 'bat --style=numbers --color=always {}'"
searchEdit() { du -a ~/Dropbox/ ~/.config/ ~/.local/bin/ | awk '{print $2}' | fzf | xargs -r $EDITOR ; }
# Create a folder and move into it in one command
mkcd() { mkdir -p "[email protected]" && cd "$_"; }
# Search quickly: googleit "What is the capital of France"
googleit() { xdg-open "http://google.com/search?q=[email protected]"}
# Command-line calculations: calc "3*4"
calc() { bc -l <<< "[email protected]" }
# Search inside files recursively in my Hugo's content folder
myripgrep() { rg "[email protected]" ~/JustToThePoint/content/}
# Search inside files in my Hugo's content folder and in Google: myripgrep "ripgrep"
mysearch() { rg "[email protected]" ~/JustToThePoint/content/; xdg-open "http://google.com/search?q=[email protected]"}
# It converts the video (url specified as a parameter) to mp3 and saves it in the Music folder.
ytmp3() { cd ~/Music; youtube-dl --extract-audio --audio-format mp3 "[email protected]"; }
# Play all music files from the Music directory
alias playmp3='cd ~/Music; nvlc *.mp3'
alias server="ssh -p '2222' '[email protected]ver'"
# Convenient aliases for xclip, a command line clipboard manager
alias copy='xclip -selection clipboard'
alias paste='xclip -selection clipboard -o'


fish is a smart and user-friendly command line shell.

  1. Install fish shell: sudo apt install fish
  2. Make it your default shell: chsh -s /usr/bin/fish. If you want to change back to your bash shell: chsh -s /usr/bin/bash
  3. It performs syntax highlighting as you type. Invalid commands are colored red by default: ct. As you type, it will suggest commands to the right of the cursor. When the text becomes a valid command, it is shown in a different color: cd /usr/share/doc/xmobar/examples.
  4. Tab Completions work out of the box: mk(Tab) -commands-, mkdir (Make directories); /etc/m(Tab) -paths-; rm -(Tab) -arguments, -f (Never prompt for removal)…
  5. You can get help in a web browser (help) or using man in the terminal (man fish).
  6. Install Fisher, a plugin manager for Fish: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher. You could also install some plugins, e.g., fisher install jethrokuan/z; z is a port of z for the fish shell, eg. z fish will likely lead you to .config/fish. Another nice plugin is Sparklines for fish: fisher install jorgebucaran/spark.fish
  7. Let’s edit Fish’s configuration file: vim /home/nmaximo7/.config/fish/config.fish
# Aliases
alias efish 'vim ~/.config/fish/config.fish'
alias evim 'vim ~/.vimrc'
alias cat 'bat'
alias rfish 'source ~/.config/fish/config.fish'
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"

function fish_greeting
    fortune | cowsay

# PROMPT: https://fishshell.com/docs/current/cmds/fish_prompt.html
function fish_prompt -d "Write out the prompt"
    # This shows up as [email protected] /home/user/ >, with the directory colored
    # $USER and $hostname are set by fish, so you can just use them
    # instead of using `whoami` and `hostname`
    printf '%[email protected]%s %s%s%s > ' $USER $hostname \
        (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
Bitcoin donation

JustToThePoint Copyright © 2011 - 2022 PhD. Máximo Núñez Alarcón, Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.