Super beautiful shell for Linux
First a beautiful picture
##1 zsh introduction
1.1 Linux shell
Linux/Unix provides many kinds of Shells, why do you need so many Shells? Is it used for frying? Then let me ask you, why do you have so many pieces of the same type of clothes? The color and texture are different. Writing a program is much more complicated than buying clothes, and programmers are often responsible for making complex things simple and simple things complicated. When great programmers see a shell they are unhappy with, they will rewrite it themselves and gradually form some standards. There are several commonly used shells, such as sh, bash, csh, etc. If you want to know how many shells your system has, you can View through the following command:cat /etc/shells
1.2 Introduction to zsh
Zsh is a powerful shell under Linux. Since most Linux products are installed and use bash by default shell
, but this does not affect geeks' enthusiasm for zsh at all. Almost every Linux product contains zsh, which can usually be installed using package managers such as apt-get, urpmi or yum
Zsh has the following main functions
Out-of-the-box, programmable command line completion function can help users enter various parameters and options
Sharing command history among all shells started by the user
With extended file wildcards, this can be achieved without using external commands The find command generally expands file names
Improved variable and array handling
In the buffer Edit multi-line commands in the zone
##Multiple compatibility modes, for example, you can disguise yourself as Bourne shell when running with /bin/sh 可以定制呈现形式的提示符;包括在屏幕右端显示信息,并在键入长命令时自动隐藏
可加载的模块,提供其他各种支持:完整的 TCP 与 Unix 域套接字控制,FTP 客户端与扩充过的数学函数
完全可定制化
1.3 zsh 与 oh-my-zsh 终极配置
之前是因为看到这篇文章:终极 Shell——Zsh 才选择使用 zsh,被它的自动完成、补全功能吸引了。官网:www.zsh.org
选择 oh-my-zsh, oh-my-zsh 是基于 zsh 的功能做了一个扩展,方便的插件管理、主题自定义,以及漂亮的自动完成效果。
在 Github 上找关于 zsh 的项目时发现的,试用了一下觉得很方便,不用像上面文章里面提到的那么复杂,配置一些插件的名称即可使用相应的功能。
牛逼啊!接私活必备的 N 个开源项目!赶快收藏
官网:https://github.com/robbyrussell/oh-my-zsh
2 安装 zsh
2.1 安装 zsh
对于一般的 Ubuntu 系统,配置好正确的源之后,就能直接键入以下命令安装:
sudo apt-get install zsh
2.2 配置 zsh
zsh 的配置是一门大学问,这里不赘述,直接给出一个配置文件,大家可以下载后放入 zsh 配置文档直接使用。(我的一个法国朋友手配的,相当顺手)
把. zshrc 拷贝到相应用户的 home 目录即可(也可以把你的 bash 的配置文件 (~/.bash_prorile 或者~/.profile 等) 给拷贝到 zsh 的配置文件~/.zshrc 里,因为 zsh 兼容 bash)
2.3 取代 bash,设为默认 shell
sudo usermod -s /bin/zsh username
或者
chsh -s /bin/zsh
chsh -s `which zsh`
如果要切换回去 bash:
chsh -s /bin/bash
当然你实在不愿意把 zsh 当成默认的 shell, 而又想使用它, 那么你可以每次进入是都使用zsh
进入, 而输入exit
退出

2.4 安装 oh-my-zsh
直接用 zsh 会很蛋疼,因为 zsh 功能很强大但是太复杂,所以需要 oh-my-zsh 来将它简单化。另外,搜索公众号Linux就该这样学后台回复“Linux”,获取一份惊喜礼包。
直接用 git 从 github 上面下载包
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
备份已有的 zshrc, 替换 zshrc
cp ~/.zshrc ~/.zshrc.origcp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
直接使用脚本安装
cd oh-my-zsh/tools./install.sh
你可以直接直接使用如下命令安装
curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
其本质就是下载并执行了 github 上的 install.sh 脚本, 该脚本位于oh-my-zsh/tools/install.sh
配置主题
oh-my-zsh 集成了大量的主题, 位于 oh-my-zsh/theme
配置主题, 可以通过修改~/.zshrc
中的环境变量ZSH_THEME
来完成
ZSH_THEME="agnoster" # (this is one of the fancy ones)
如果你觉得主题太多你可以选择使用随机模式, 来由系统随机选择
ZSH_THEME="random" # (...please let it be pie... please be some pie..)

详细的主题信息, 可以参见 zsh 主题介绍
配置插件
修改~/.zshrc
中plugins
plugins=(git bundler osx rake ruby)
详细的插件信息, 可以参见 zsh 插件 Plugins 介绍
更新 oh-my-zsh
默认情况下, 您将被提示检查每几周的升级. 如果你想我 ZSH 自动升级本身没有提示你, 修改 `~/.zshrc。另外,搜索公众号顶级算法后台回复“算法”,获取一份惊喜礼包。
disable_update_prompt = true
禁用自动升级, 修改~/.zshrc
disable_auto_update = true
当然你也可以选择手动更新
如果你想在任何时间点升级(也许有人刚刚发布了一个新的插件,你不想等待一个星期?) 你只需要运行:
upgrade_oh_my_zsh
卸载 oh-my-zsh
If you want to uninstall oh-my-zsh
, just execute uninstall_oh_my_zsh zsh
, run from the command line. This will delete itself and restore your previous bash or zsh configuration.
The above is the detailed content of Super beautiful shell for Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



<p>Customizing your operating system is a great way to make your daily life more enjoyable. You can change the user interface, apply custom themes, add widgets, and more. So today we will show you how to install ClassicShell on Windows 11. </p><p>This program has been around for a long time and allows you to modify the operating system. Volunteers have now started running the organization, which disbanded in 2017. The new project is called OpenShell and is currently available on Github for those interested. </p>&a
![Explorer.exe does not start on system startup [Fix]](https://img.php.cn/upload/article/000/887/227/168575230155539.png?x-oss-process=image/resize,m_fill,h_207,w_330)
Nowadays, many Windows users start encountering severe Windows system problems. The problem is that Explorer.exe cannot start after the system is loaded, and users cannot open files or folders. Although, Windows users can open Windows Explorer manually using Command Prompt in some cases and this must be done every time the system restarts or after system startup. This can be problematic and is due to the following factors mentioned below. Corrupted system files. Enable fast startup settings. Outdated or problematic display drivers. Changes were made to some services in the system. Modified registry file. Keeping all the above factors in mind, we have come up with some that will surely help the users

Do you see this error message "Add-AppxPackage: Deployment failed with HRESULT: 0x80073D02, The package cannot be installed because the resource it modifies is currently in use. Error 0x80073D02..." in PowerShell when you run the script? As the error message states, this does occur when the user attempts to re-register one or all WindowsShellExperienceHost applications while the previous process is running. We've got some simple solutions to fix this problem quickly. Fix 1 – Terminate the experience host process You must terminate before executing the powershell command

When processing files under Linux systems, it is sometimes necessary to delete lines at the end of the file. This operation is very common in practical applications and can be achieved through some simple commands. This article will introduce the steps to quickly delete the line at the end of the file in Linux system, and provide specific code examples. Step 1: Check the last line of the file. Before performing the deletion operation, you first need to confirm which line is the last line of the file. You can use the tail command to view the last line of the file. The specific command is as follows: tail-n1filena

Open shell not running on Windows 11 is not a new problem and has been plaguing users since the advent of this new operating system. The cause of the Open-Shell Windows 11 not working issue is not specific. It can be caused by unexpected errors in programs, the presence of viruses or malware, or corrupted system files. For those who don’t know, Open-Shell is the replacement for Classic Shell, which was discontinued in 2017. You can check out our tutorial on how to install Classic Shell on Windows 11. How to replace Windows 11 Start menu

Windows Subsystem for Linux The first option is to use Windows Subsystem for Linux or WSL, which is a compatibility layer for running Linux binary executables natively on Windows systems. It works for most scenarios and allows you to run shell scripts in Windows 11/10. WSL is not automatically available, so you must enable it through your Windows device's developer settings. You can do this by going to Settings > Update & Security > For Developers. Switch to developer mode and confirm the prompt by selecting Yes. Next, look for W

Some examples of Python scripts: enterprise WeChat alarms, FTP clients, SSH clients, Saltstack clients, vCenter clients, obtaining domain name SSL certificate expiration time, sending today's weather forecast and future weather trend charts; some examples of Shell scripts: SVN Full backup, Zabbix monitoring user password expiration, building local YUM, and the readers' needs in the previous article (when the load is high, find out the process scripts with high occupancy and store or push notifications); it is a bit long, so please read it patiently At the end of the article, there is an Easter egg after all. Python script part of enterprise WeChat alarm This script uses enterprise WeChat application to perform WeChat alarm and can be used

OpenShell is a free software utility that can be used to customize the Windows 11 Start menu to resemble a classic-style menu or a Windows 7-style menu. The Start menu on previous versions of Windows provided users with an easy way to browse the contents of their system. Basically, OpenShell is a replacement for ClassicShell that provides different user interface elements that help to get the functionality of the latter version from previous Windows versions. Once development of ClassicShell ceased in 2017, it was maintained and developed by GitHub volunteers under the name OpenShell. It is related to Win
