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/shellsThe display is as follows:
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!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
