【Linux】Ubuntu配置zshell&oh-my-zsh

zshell:https://archive.codeplex.com/?p=shellhtml

oh-my-zsh: https://github.com/robbyrussell/oh-my-zshlinux

終極 Shell——Zsh: https://linuxtoy.org/archives/zsh.htmlgit

Linux終極shell-Z Shell--用強大的zsh & oh-my-zsh把Bash換掉: https://blog.csdn.net/gatieme/article/details/52741221github

查看當前系統的shells

xinchen@ubuntu:~$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen

安裝zsh

sudo apt-get install zsh

切換bash爲zsh

# usermod命令用於修改用戶的基本信息
# 
# usermod -G staff newuser2  (將newuser2添加到組staff中)
# usermod -l newuser1 newuser (修改newuser的用戶名爲newuser1)
# usermod -L newuser1 (鎖定帳號newuser1)
# usermod -U newuser1 (解除對newuser1的鎖定)
sudo usermod -s /bin/ash $USERNAME

# or
chsh -s /bin/zsh
chsh -s `which zsh`

# 切換回bash
chsh -s /bin/bash

安裝oh-my-zsh

官網推薦

Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl or wget.shell

# curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

# The default location is ~/.oh-my-zsh (hidden in your home directory)
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

github下載

# git clone
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

# 備份已有的zshrc, 替換zshrc, 至此可直接使用
cp ~/.zshrc ~/.zshrc.orig
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# 直接使用腳本安裝
cd oh-my-zsh/tools
./install.sh

主題

# Once you find a theme that you'd like to use, you will need to edit the ~/.zshrc file. You'll see an environment variable (all caps) in there that looks like:
ZSH_THEME="robbyrussell"

# If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
ZSH_THEME="random" # (...please let it be pie... please be some pie..)

# And if you want to pick random theme from a list of your favorite themes:
ZSH_THEME_RANDOM_CANDIDATES=(
  "robbyrussell"
  "agnoster"
)

插件

# ~/.zshrc
plugins=(git encode64 urltools)

升級

# By default, you will be prompted to check for upgrades every few weeks. If you would like oh-my-zsh to automatically upgrade itself without prompting you, set the following in your ~/.zshrc:

DISABLE_UPDATE_PROMPT=true

# To disable automatic upgrades, set the following in your ~/.zshrc:

DISABLE_AUTO_UPDATE=true

# If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run:

upgrade_oh_my_zsh

卸載

If you want to uninstall oh-my-zsh, just run uninstall_oh_my_zsh from the command-line. It will remove itself and revert your previous bash or zsh configuration.ubuntu

相關文章
相關標籤/搜索