ZSH – Pretty, what else is great about it

29/12/2020
Chưa phân loại
Zsh is touted as a great alternative to bash and all other shells. The shell has many of the features, if not all of bash but with enhancements. It is better, according to its fans, at globbing, editing commands and menu completion features. If you start hopping from bash to other solutions, check out zshell and see if you like it.

Why do lovers love zsh?

As expected, when zsh starts, you see little difference from other shells. Go through a tutorial from the web and see how you like it. One great suggestion is to use oh-my-zsh, it is a community driven collection of tools for zshell. Some of the first things you may notice are automatic cd into directories. Just start typing a directory name and zsh will fill it up. You will also get recursive expansion, a directory name usr/bin can be abbreviated /u/b and zsh will expand it. You also have switch search, this feature lists any available switches for the command you started typing.

How do you install it?

Your distribution comes with bash, most likely, if you want to switch to zshell, you can install it with your package manager.

$ sudo apt install zsh

When that is done, you need to configure it to your own liking. Fortunately, zsh will run a script for you if you have no settings in your home directory.

You can show some standard defaults but to take full advantage of the shell, read through the manual and choose some more features. There are many choices, follow along further down for some options about this.

All these steps only sets up how the script runs, when you have decided to use it as your standard shell, you need more actions. You have several methods to achieve this. Which shell you use as standard is set in the ‘/etc/passwd’ file. You have many users in this file even if only you use this machine. The other users are there to act as special users for specific applications. If you search in it, you can find the gdm user, which runs gdm3 before you login. For this reason, you need to search for your username and check the values. Your shell is the last value in the list, to change the values, you need to be root. Change the value to ‘/bin/zsh’ or ‘/usr/bin/zsh’, check with ‘which zsh’.

You also have a command line utility, chsh. This is necessary if you are not root on the machine. As a regular user run:

$ chsh -s /usr/bin/zsh

The change does not take effect immediately, you must log out and back in first.

Where are the configure files?

For zshell, the designers have made it clear and consistent. The files have the same names but in different locations. The environment variables go in etc/zsh/zshenv and ~.zshenv. These are always read but seldom used. The files for when you login are etc/zsh/zprofile and ~.zshprofile. For the login shell, when you run external commands, the files are etc/zsh/zshlogin and ~.zshlogin respectively. Finally, for your interactive shell you set values in etc/zsh/zlogin and ~.zlogin.

For personal preferences and making your shell work better for you, you should edit your local ~/.zshrc.

How do you get started?

The best thing about zsh is the configuration script that sets some decent defaults. Before you dig deep into the documentation and try to set every detail of the config, try a few frameworks. You will probably run into Oh-My-Zsh, this framework has it almost all. There are both themes and plug-ins available. Get in the habit of checking out what is available and how it works. Many of the plug-ins are for a special need. The Ansible module has aliases for working with Ansible, so consider which ones you install. To find modules, start with the ‘Oh-My-Zsh’ package, mentioned earlier. If you start with the plugins on their GitHub page, you can find many plugins contributed by the community. When you see something you like, just add it to the ‘plugins’ entry in your .zshrc file.


plugins=(git web-search)

Try a few at a time and make sure you don’t add too many, it will slow the start of the shell.

How do you change it to your f(l)avour?

There are also themes to make it look better. They set colour and the prompt, they are also possible to look different depending on how if have logged in on console or ssh. Many of these themes also respond dynamically to git status of the current directory. You can create these themes your self, they are shell scripts that set the prompt and create functions to handle your environment.

Conclusion

Zshell has a definitive learning curve, though not a very steep one. There are also a large community who share generously of their own customisation scripts. As soon as you start working in the shell, it is worth taking a look at the power of the shell. If you are not using the shell yet, get started. Many things seem harder but are simpler after you know some details.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Hướng dẫn cách sử dụng câu lệnh History trong Linux

Trong bài viết này, Onet sẽ giúp các bạn tìm hiểu làm thế nào bạn có thể sử dụng lệnh history...
30/12/2020

How to Install Dropbox on Manjaro Linux

If you’re an internet user for quite some time, then you may have already heard the name of Dropbox, or you’re already...
29/12/2020

Mua Proxy Game – Giải pháp tuyệt vời cho việc chơi game trên mạng mà không bị giới hạn về vị trí địa lý

Lý Do Mua Proxy HTTP & SOCKS5 giá rẻ tại Onet.com.vn Tốc độ cao – proxy của chúng tôi...
03/06/2023
Bài Viết

Bài Viết Mới Cập Nhật

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
16/05/2024

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
16/05/2024

Địa chỉ thuê mua proxy chạy ads chất lượng, nhanh chóng
16/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024