zsh Efficient command line

Source: Internet
Author: User
Tags best plugins git commands brew cask proxychains

Zsh

Zsh may be the best shell to use at the moment, and it's a good one for bash alternatives. Here are some of the advantages of zsh: why use zsh.

Mac comes with zsh, but of course we want to use the latest version, other distributions please refer to the respective Software installation method. Once the installation is complete, reopen the ITerm2.

Brew install zshchsh-s ' which zsh '

Complement the whole

ZSH's command complement function is very powerful, can fill the path, complete the command, complete parameters and so on. Do you remember all the parameters of tar??, as long as the tar- Add Tab key, no longer RTFM?? )

ZSH Auto Complete

Press the TAB key to display all of the options, then press the TAB key, that is, enter the selection mode, after entering the selection mode, press TAB to cut down an option, press Shift+tab to cut up an option, ctrl+f/b/n/p can be left and right to switch.

Zsh tab Toggle

Previous kill process is ps aux | grep xxx CHECK process pid, then kill PID. With zsh, kill xxx directly and press the TAB key.

Kill emacs# Press TAB and turn to: Kill 59683

Alias

Zsh not only supports generic alias, it also supports alias for file type. The file types I configured are as follows:

Alias-s gz= ' tar-xzvf ' alias-s tgz= ' tar-xzvf ' alias-s zip= ' unzip ' alias-s bz2= ' tar-xjvf ' alias-s php=vialias-s py=vial Ias-s rb=vialias-s html=vialias gcid= "git log | head-1 | awk ' {print substr (\$2,1,7)} ' | Pbcopy "

After the configuration is complete, the direct input xxx.rbunder Zsh, will automatically open with VI, direct input xxx.tgz, will be directly extracted according to 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 under Mac, Linux refer to the corresponding release change), when performing rebase Not convenient.

Jump

Zsh's Directory jump is smarter, you don't need to enter a CD, just enter the path. .. Represents a fallback level of directory,. /.. / indicates back level two, and so on. ( ..... The role and the . /.. / Same)

Enter dto list all directories accessed by the current session, and then enter the appropriate directory by the number of prompts.

~> d0~1~/applications2~/.proxychains3/opt/homebrew-cask/caskroom~> 1~/applications

Historical records

Zsh's history spans the session and can be shared. History supports restricted lookups. For example, enter gitand press the UP arrow to search for all the GIT commands you've used.

Wildcard Search

ls *.png finds all PNG files in the current directory,LS **/*.png recursive lookup.

Oh-my-zsh

Oh-my-zsh is the most popular zsh profile, offering a wide range of themes and plugins, greatly extending the functionality of ZSH, driving the popularity of zsh, a bit like rails for Ruby.

# install# via Curlsh-c "$ (Curl-fssl https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" # via Wget sh-c "$ (wget Https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh-O-)"

After installation,source ~/.ZSHRC to make it effective.

Theme

Oh-my-zsh has a large number of themes built in, and you can view specific configurations in ~/.oh-my-zsh/themes . The official website offers a number of topics. Also see my answer.

# The theme I use is Avit, which shows git information well/volumes/disk image/cloudoffice master? 37m> Mouse on a new line

Plug - ins

Oh-my-zsh provides a very rich plugin to view specific configurations in the ~/.oh-my-zsh/plugins directory. Write plugin (git autojump osx) in . ZSHRC to use plugins, and here are a few of the very best plugins.

Git

Streamline git commands and reduce the number of characters you enter. See Plugin:git. The plug-in provides a lot of shortcut commands, pick a few common and memorable memories can be, do not have to remember all. I used to have GST, ggp, gco, gcm, GCP and so on.

AutoJump

AutoJump records the path according to your usage frequency, making the jump of the directory more convenient. Install the Brew install AutoJump. To jump to a directory containing ' foo ', execute J foo, which is the most basic and most commonly used command. In addition, there are JC, Jo,jco commands, to view the official website of the document for more ways to use.

Os x

The plugin enhances the experience of using the MAC and provides the following commands:

    • CDF : Open the directory you want to CD in the Finder;

    • quick-look : Quickly preview the file, similar to pressing the SPACEBAR in the Finder,

    • man preview : Open man page in preview,

    • itunes : Command line operation itunes.

> Itunesitunes:shift:2: Shift count must be <= $ #Usage: itunes <option>option:launch|play|pause|stop|rewind |resume|quitmute|unmutecontrol Volume Setnext|previousplay Next or previous trackshuf|shuffle [On|off|toggle]set Shuffled playback. Default:toggle. Note:toggle doesn ' t support the miniplayer.volset the volume, takes a argument from 0 to 100helpshow this message and ex It

Additional commands to view plugins.

Proxychains

Proxychains is a scientific online tool for the command line. Install the Brew install Proxychains-ng. , Amazon S3 storage services and GitHub are not stable and sometimes require scientific access to the Internet.

# Original Command Brew cask install xxx# use PROXYCHAINSPROXYCHAINS4 Brew cask install XXX

Proxychains

OtherAg

AG is a new search tool:

    • Compared with the ACK , the speed has a huge increase, here is a contrast;

    • The search ignores the pattern in . Gitignore and . Hgignore ;

    • Files that you do not want to search can write the corresponding pattern in the . Agignore ;

    • The command is 33% shorter than the ack , and one hand can be pressed full.

The last one, though seemingly playful, reveals the essence of the tool: even if it is possible to reduce the input of a character, it is necessary to progress.

Htop

The Htop is a Linux system monitoring and process management software that replaces the traditional Unix top. Unlike top, which provides only the most resource-consuming list of processes, Htop provides a list of all processes and uses color to identify processor, swap, and memory states. 1

Htop

Htop Command Advantage 2:

    • Quickly view key performance statistics such as CPU (multi-core layout), memory/swap usage;

    • You can scroll through the list of processes horizontally or vertically to see all the processes and the complete command line;

    • Kill the process can be directly selected without the need to enter the process number;

    • The entry by mouse operation;

    • Starts faster than top.

Ccat

Ccat is colored.Cat, syntax highlighting is provided on a cat basis. Available throughBrew Install CcatInstallation. is currently supportedRuby,python,JavaScript,Java,C,Go。


zsh Efficient command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.