mac shells and shell switching

mac shells

There are many kinds of shells, and OS X can be viewed using cat /etc/shells, for example:

ylspirit:~ ylspirit$ cat /etc/shells

OS X comes with zsh, Linux needs to install yum install zsh, Ubuntu apt-get install zsh.

The default shell for both Linux and OS X is bash.

However, since zsh is more powerful and convenient, it is also fully compatible with bash. It is recommended to use zsh instead of bash.

Zsh and bash switch

The shell currently in use by the system:

Switch to zsh shell:

ylspirit:~ ylspirit$ chsh -s /bin/zsh

Note: If you enter the command and password prompt: no change made. Please add sudo and try again, then re-open the terminal and switch successfully.

Zsh common alias settings

Edit the .zshrc file in the username directory.

vim .zshrc

#input
alias ll="ls -l"
alias dd="cd ~/Downloads"
alias dw="cd ~/Documents"
alias grep="grep --color=auto"
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

To make the new configuration of .zshrc take effect immediately (current zsh session), use the source .zshrc command.

ylspirit% source .zshrc 

OK.

Add a Comment

Your email address will not be published. Required fields are marked *