Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Bazsmagister/3aeca5d95fb61eced3b51c40aa591ad3 to your computer and use it in GitHub Desktop.
Save Bazsmagister/3aeca5d95fb61eced3b51c40aa591ad3 to your computer and use it in GitHub Desktop.

Install Zsh and Oh-my-zsh on CentOS 7

Based on this article

ALL INSTALLATIONS ASSUME YES WHEN PROMPTED, that's what -y does

yum install zsh -y
chsh -s /bin/zsh root
echo $SHELL
yum install wget git -y
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

/bin/cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
source ~/.zshrc

plugins: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins There are tons of plugins that are supported by OH-MY-ZSH. Setting up a plugin is quite easy. All you have to do is get the plugin package and add the plugin name in the plugins parameter on the .zshrc file. clone plugins:

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

go into the ~/.zshrc file and uncomment the following line:

nano ~/.zshrc

or

mcedit ~/.zshrc

find this line: # plugins=(git) if commented out, then uncomment and add zsh-autosuggestions to it:

plugins=(git zsh-autosuggestions zsh-syntax-higlighting z)

still in zshrc you can make aliases:

#aliases

alias zshconfig="~/.zshrc"

alias ohmyzsh="~/.oh-my-zsh"

alias cls='clear'

alias pa='php artisan'

alias vsc='code .'

alias paclear='php artisan view:clear && php artisan cache:clear && php artisan config:clear && php artisan rout$

alias pamf='php artisan migrate:fresh'

alias cda='composer dump-autoload'

alias ga='git add .'

alias parl='php artisan route:list'

alias glnice='git log --graph --oneline --decorate --all'

alias cda='composer dump-autoload'

#alias nah="git reset --hard && git clean -df"

alias phpserver="php -S localhost:8000"

#alias pythonserver='python -m SimpleHTTPServer 8000'

#alias lumenserver='php -S localhost:8000 -t public'

#alias myip="curl http://ipecho.net/plain; echo"

Now source (source ~/.zshrc) file for changes to be effective:

source ~/.zshrc

Now you can see from the screenshot the auto-suggestion feature is enabled and it remembers the command I used previously and suggests based on it.

As you type a command, Oh My Zsh will make suggestions based on your history. If the suggestion is the one you are looking for, press the → key to accept it. A real time saver!


uninstall:

uninstall_oh_my_zsh

or

source ~/.oh-my-zsh/tools/uninstall.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment