Super Cool command line extension tool Oh My Zsh on Linux

Source: Internet
Author: User
Tags echo command

Oh my Zsh is a community-driven command-line tool, as it says on its home page, Oh my Zsh is a way of life. It is based on the ZSH command line, provides the theme configuration, plug-in mechanism, has built-in convenient operation. Give us a whole new way to use the command line.

What is Oh My Zsh
Oh My Zsh The name sounds interesting-it's an extended toolset based on the Zsh command line, and it provides a rich set of extensibility features. Oh My Zsh's homepage, there is a clear explanation for its definition: http://ohmyz.sh

About Zsh, it is a command-line program. The bash command line is used by default on our MAC system, and Zsh is another command-line environment, about zsh everyone can go to its official website to understand: http://www.zsh.org/

We can enter this command at the command line to see if the ZSH command line is installed on our computer:

Zsh--version

If installed, this command will output the current version number of the zsh. After confirming that the zsh has been installed, we can continue to install Oh My zsh.

Oh My Zsh is not what
Speaking of command-line tools, our first feeling, Oh My Zsh is this?

Well.. That's half right, Oh My Zsh is just a configuration wrapper framework for the ZSH command line environment, but it doesn't provide a command-line window, and it's not a standalone APP.

The command-line interface in the MAC system can be a Terminal program that comes with a third-party, such as a iTerm.

In short, Oh My Zsh is not a substitute for a command-line tool, but rather a complement to each of them. You can use Oh my Zsh with iTerm so you can get the convenience of the Oh My Zsh command-line environment, as well as the operation support of the command-line GUI tools provided by ITerm.

Just like the homepage of Oh My Zsh: "When you use these very cool command-line tools, people come to your computer and they will definitely praise your command line." Welcome to a little praise. ”

Install Oh My Zsh
We understand the general situation of Oh My Zsh, so let's start the installation.

Oh My Zsh is very simple to install, with a clear description on its home page: http://ohmyz.sh

It can be installed with a single command via curl or wget.

Curl Mode:

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

Wget Way:

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

The output of the installation process is as follows:


Cloning Oh My Zsh ...
Cloning into '/users/icafe/.oh-my-zsh ' ...
Remote:counting objects:712, done.
Remote:compressing objects:100% (584/584), done.
Remote:total 712 (Delta), reused 522 (Delta 4), pack-reused 0
Receiving objects:100% (712/712), 443.58 KiB | 27.00 kib/s, done.
Resolving deltas:100% (15/15), done.
Checking connectivity ... done.
Looking for an existing zsh config ...
Using the Oh My Zsh template file and adding it to ~/.ZSHRC
Copying your current PATH and adding it to the end of ~/.ZSHRC for you.
Time to change your default shell to zsh!
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/.... is now installed!
~/.ZSHRC file to select Plugins, themes, and options.
P.S. Follow us at https://twitter.com/ohmyzsh.
P.p.s. Get stickers and T-shirts at http://shop.planetargon.com.

Here, Oh My Zsh is installed successfully. As you can see now, our command-line prompt has changed to this:

Set theme
After the installation is complete, we can use it, let's start with a simple configuration.

Oh My Zsh offers a lot of theme style, we can set the theme style according to our own preferences, theme configuration in the ~/.ZSHRC file can be seen, with a familiar editor to open this file, you can find this:

Zsh_theme= "Robbyrussel"

As you can see, the theme we use by default is called Robbyrussel. It shows the effect, probably like this:

Oh My Zsh comes with some default themes, which are stored in the ~/.oh-my-zsh/themes directory. We can look at these topics:

Themes git: (master) LS

3den.zsh-theme Essembeh.zsh-theme Junkfood.zsh-theme Rgm.zsh-theme
Soliah.zsh-theme Evan.zsh-theme Kafeitu.zsh-theme Risto.zsh-theme
Adben.zsh-theme Example.zsh-theme Kardan.zsh-theme Rixius.zsh-theme
Af-magic.zsh-theme Fino-time.zsh-theme Kennethreitz.zsh-theme Rkj-repos.zsh-theme
Afowler.zsh-theme Fino.zsh-theme Kiwi.zsh-theme Rkj.zsh-theme
Agnoster.zsh-theme Fishy.zsh-theme Kolo.zsh-theme Robbyrussell.zsh-theme
Alanpeabody.zsh-theme Flazz.zsh-theme Kphoen.zsh-theme Sammy.zsh-theme
Amuse.zsh-theme Fletcherm.zsh-theme Lambda.zsh-theme Simonoff.zsh-theme
Apple.zsh-theme Fox.zsh-theme Linuxonly.zsh-theme Simple.zsh-theme
Arrow.zsh-theme Frisk.zsh-theme Lukerandall.zsh-theme Skaro.zsh-theme
....
How about the number of the default theme is quite a lot of it, this is the power of community-driven, from Oh My Zsh This Logo can be reflected ~

With so many themes to suit your preferences, we just need to configure the required topics in the./zshrc file, for example, we want to use the Lambda.zsh-theme theme, as long as we configure this:

Zsh_theme= "Lambda"

Then save the file and open a new command-line window to see the effect. So many topics how to quickly find what we like, we can also set up:

Zsh_theme= "Random"

We set the theme to random so that every time we open a command-line window, we randomly select one of the default themes. So we can use the echo command to output the name of the current theme if we think the current theme is more like it:

Echo $ZSH _theme

Then set him up in the configuration file.
Quick selection of directories and files
The subject is finished, we are going on. We use another command-line environment, obviously not only to use more themed styles, but more importantly, this command-line environment makes it easier for us to use. So, let's keep looking at the handy things that Oh My Zsh has to offer.

When we use command-line tools to switch between directories and files using a CD-like command, a pain point is that we have to look at the directory structure and file name first. For example, we want to use the CD command to enter a directory, then we must first know the name of this directory. This is not used to friends who are accustomed to using a GUI tool like the Finder. In bash, we typically use the LS command to list the current directory before using the CD command to enter a directory:

Ls-l

~DRWX------4 Icafe Staff 136 9 12:34 applications
DRWX------+ Icafe staff 1360 Oct 11:15 Desktop
DRWX------+ Icafe staff 442 Oct 19:49 Documents
DRWX------+ Icafe staff 1564 OCT 31 08:15
[email protected] Icafe staff 1938 OCT 05:45 Library
CD library/
The bash on the MAC has also done some optimizations, and after we've entered a portion of the directory, we can press the TAB key to auto-fill to help us match the directory name at the beginning of the prefix:

CD Li

Press the TAB key:

CD library/

The directory name will be filled in according to the prefix matching function. But this is still some inconvenient, such as this auto-completion function is the exact match case, join us to enter the CD Lib and then press the Tab key, it is not able to match to the Library directory, because their case does not match.

Oh my Zsh provides a better solution, we enter CD Lib in the command line of Oh my Zsh and press the TAB key:

CD library/

A successful match to the Library directory. If we add a space after the CD command, then press the TAB key:

CD <Tab>

applications/system/bin/dev/net/sbin/[email protected]
library/users/cores/[email protected] opt/[email protected] User Information @
network/volumes/data/home/private/usr/
Lists all subdirectories and files in the current directory directly, in this state, if we continue to press a Tab key.

You will find that we can move through the cursor and select from this list of directories and files:

Oh My Zsh This feature is still very convenient.

Conclusion
Oh My Zsh The best part of it is its community drive, the various topics we've described earlier, and the handy directory operations, just a small portion of it. and its plug-in mechanism is also a very powerful place to evolve the command line into a variety of forms that meet our needs.

Super Cool command line extension tool Oh My Zsh on Linux

Related Article

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.