Install oh-my-zsh on system-wide

# do the following on root (sudo)

sudo -s

#centos
yum -y install vim git zsh tmux sqlite
#ubuntu
apt -y install vim git zsh tmux tree sqlite3

ZSH=/oh-my-zsh
sudo git clone https://github.com/ohmyzsh/ohmyzsh $ZSH

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

echo 'ASSET=""' >> $ZSH/themes/dallas.zsh-theme
echo '[[ -f /etc/asset ]] && ASSET=$(echo "[$(cat /etc/asset)]")' >> $ZSH/themes/dallas.zsh-theme
echo 'PROMPT="[!%!]$ASSET$DALLAS_CURRENT_TIME_\$(ruby_prompt_info)$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ "' >> $ZSH/themes/dallas.zsh-theme

ZSHRC=$ZSH/templates/zshrc.zsh-template
sed -i $ZSHRC -e 's#^export ZSH=$HOME/.oh-my-zsh#export ZSH=/oh-my-zsh#g'
sed -i $ZSHRC -e 's/^ZSH_THEME="robbyrussell"/ZSH_THEME="dallas"/g'
sed -i $ZSHRC -e 's/^plugins=.git.$/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/g'
sed -i $ZSHRC -e 's/^# DISABLE_AUTO_UPDATE="true"/DISABLE_AUTO_UPDATE="true"/g'

cat << EOL >> $ZSHRC
#alias ls='ls --color=tty --time-style=long-iso'
alias ls='ls --color=tty --time-style="+%Y-%m-%d %a %H:%M:%S"'
alias vi='vim'

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
EOL


cp /oh-my-zsh/templates/zshrc.zsh-template /etc/skel/.zshrc
[[ -f /bin/zsh ]] && sed -i /etc/default/useradd -e 's/bash/zsh/g'
# cp /oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# chsh
Changing shell for root.
New shell [/bin/bash]
/bin/zsh
Shell changed.

Convert Bash History → Zsh History (if needed)

mv ~/.bazh_history ~/.zsh_history
  • 레이블 없음