What advantages does it have over Bash, TCSH, etc.? If the advantage is very prominent, can you just learn ZSH?
ZSH command completion function is very powerful, you can complete the path, command, parameter, etc. (Have you memorized all the parameters of tar? Just tar – TAB, never use RTFM.)
After you enter the selection mode, press TAB to switch to the next option, press Shift + TAB to switch to the next option, press CTRL + F/B/N/P to switch to the left, right, and forward.
kill
Check before killing process is ps aux | grep XXX process of PID, and then kill the PID. With ZSH, just kill XXX and press TAB
Kill emacs # Press TAB to change to: kill 59683Copy the code
ZSH supports aliases for file types as well as plain aliases. I configured the file type alias as follows:
alias -s gz='tar -xzvf' alias -s tgz='tar -xzvf' alias -s zip='unzip' alias -s bz2='tar -xjvf' alias -s php=vi alias -s P y = vi rb = vi alias alias - s - s HTML = vi alias gcid = "git log | | head - 1 awk '{print substr (\ $2,1,7)}' | pbcopy"Copy the code
After the configuration is complete, enter xxx.rb in the ZSH file to open it automatically using vi. Enter xxx. TGZ and decompress it using tar -xzvf. The last gCID copies the id of the first commit of the current Git project to the system clipboard (pbcopy is the copy to system clipboard command for Mac, see distribution changes for Linux), which is especially handy when rebase is executed.
ZSH’s directory jump is smarter, you don’t need to type CD, just enter the path. . Indicates a level backward directory,.. /.. / means two steps backward, and so on. (… The role of… /.. / the same)
Enter d to list all directories accessed by the current session. Then press the number as prompted to enter the corresponding directory.
~
> d
0 ~
1 ~/Applications
2 ~/.proxychains
3 /opt/homebrew-cask/Caskroom
~
> 1
~/Applications
Copy the code
The historical record
ZSH history records can be shared across sessions. History supports limited lookup. For example, typing git and pressing the up arrow will search for all git commands you’ve ever used.
Wildcard search
PNG to find all PNG files in the current directory, ls **/*.
See some command-line efficiency tools for more
Iterm2: What cool features does Iterm2 have? – Answers from Zhihu users