当前位置:网站首页>Kubectl_ Easy to use command line tool: Oh my Zsh_ Tips and tricks
Kubectl_ Easy to use command line tool: Oh my Zsh_ Tips and tricks
2022-07-24 15:18:00 【InfoQ】
Zsh Tips and tricks
What is? Zsh?
install Zsh
Mac
brew install zshLinux(Ubuntu)
# 1. install zsh
sudo apt-get install zsh
# 2. Confirm whether the installation is successful
zsh --version
# 3. Set up zsh As the default shell
sudo chsh -s (which zsh)
# 4. Log out and log back in
Linux(Centos)
# 1. install zsh
sudo yum install zsh
# 2. Confirm whether the installation is successful
zsh --version
# 3. Set up zsh As the default shell
sudo chsh -s (which zsh)
# 4. Log out and log back in
# Check the current system shell
cat /etc/shells
yum remove zsh
sudo yum update -y
sudo yum install -y git make ncurses-devel gcc autoconf man
git clone -b zsh-5.7.1 https://github.com/zsh-users/zsh.git /tmp/zsh
cd /tmp/zsh
./Util/preconfig
./configure
sudo make -j 20 install.bin install.modules install.fns
command -v zsh | sudo tee -a /etc/shells
sudo chsh -s /usr/local/bin/zsh
oh-my-Zshsh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Manual installation
1.1 Uninstall lower version
# Uninstall the current version
sudo yum remove zsh
1.2 Download the source code
- Source code :https://zsh.sourceforge.io/Arc/source.html
# download
wget https://sourceforge.net/projects/zsh/files/zsh/5.8/zsh-5.8.tar.xz/download
# decompression
tar xvf zsh-5.8.tar.xz
1.3 Compilation and installation
# Install the compiler
yum install gcc perl-ExtUtils-MakeMaker
yum install ncurses-devel
# Enter the source directory
cd zsh-5.8
# Perform configuration
# Default installed in :/usr/local/bin/zsh
./configure
# Compile and install
make && make install
# Add information
vim /etc/shells
# Add in the last line :/usr/local/bin/zsh
1.4 The verification results
# Switch shell
chsh -s /usr/local/bin/zsh
# View version information
zsh --version
# zsh 5.8 (x86_64-pc-linux-gnu)
Zsh Basic commands
6 A little-known Zsh Tips and tricks
takecommand
- The command is mkdir and cd A combination of two commands . You can also generate intermediate directories as needed .
- Specify the command to view history
- Enter the specified command , Press the up arrow again , The history starting with this command can be iterated
zmv
- use zmv Rename a large number of files . First , function
autoload zmvTo installzmv. Then execute the following command :
zmv '(*).(jpg|jpeg)' 'demo-1.2'
zcalc
- Open the calculator on the command line , First , function
autoload zcalcTo installzcalc. Then you can executezcalccommand .
Ctrl-q
- When you enter a long command , When you find that you need to execute a command before it , You can press
Ctrl-qTemporarily store the current command , Then enter another command , When the execution of the other command ends , The temporary commands will be automatically refilled .
ctrl-x-e
- When you enter a long command , When you find an input error in the middle of the command , Can press
ctrl-x-eCopy the command to the editor for editing , After editing , Save to exit .
Easy to use plug-ins
plugins=(git autojump last-working-dir tmux tmuxinator web-search fancy-ctrl-z themes)
- autojump
- last-working-dir
- tmux
- tmuxinator
- web-search
- fancy-ctrl-z
install oh-my-zsh
- Can pass curl or wget Two ways to install , Install... With one command .
curl install
GitHub
:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Gitee ( Domestic mirror )
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"
wget install
GitHub
:
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Gitee ( Domestic mirror )
sh -c "$(wget -O- https://gitee.com/pocmon/mirrors/raw/master/tools/install.sh)"
[[email protected]]/fly/k8s/shell/ohmyzsh# ./install.sh
Cloning Oh My Zsh...
remote: Enumerating objects: 1280, done.
remote: Counting objects: 100% (1280/1280), done.
remote: Compressing objects: 100% (1236/1236), done.
remote: Total 1280 (delta 24), reused 1230 (delta 24), pack-reused 0
Receiving objects: 100% (1280/1280), 1.06 MiB | 1.23 MiB/s, done.
Resolving deltas: 100% (24/24), done.
From https://github.com/ohmyzsh/ohmyzsh
* [new branch] master -> origin/master
Branch master set up to track remote branch master from origin.
Already on 'master'
/fly/k8s/shell/ohmyzsh
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to /root/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc.
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Before you scream Oh My Zsh! look over the `.zshrc` file to select plugins, themes, and options.
• Follow us on Twitter: https://twitter.com/ohmyzsh
• Join our Discord community: https://discord.gg/ohmyzsh
• Get stickers, t-shirts, coffee mugs and more: https://shop.planetargon.com/collections/oh-my-zsh
upgrade oh-my-zsh
Get updates
~/.zshrc- Automatic update without confirmation :
zstyle ':omz:update' mode auto
- If updates are available , Please provide a reminder every few days :
zstyle ':omz:update' mode reminder
- To disable automatic updates completely :
zstyle ':omz:update' mode disabled
# This will check for updates every 7 days
zstyle ':omz:update' frequency 7
# This will check for updates every time you open the terminal (not recommended)
zstyle ':omz:update' frequency 0
Update manually
omz update
uninstall Oh My Zsh
oh-my-zshuninstall_oh_my_zshbashzshUse Oh My Zsh
plug-in unit
To enable the plugin
.zshrc$HOMEvim ~/.zshrc
plugins=(
git
bundler
dotenv
macos
rake
rbenv
ruby
)
# Refresh configuration
source ~/.zshrc
The use of plug-in
The theme
Select topic
~/.zshrcZSH_THEME="robbyrussell"
ZSH_THEME="agnoster" # (this is one of the fancy ones)
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster

ZSH_THEME="random" # (...please let it be pie... please be some pie..)
ZSH_THEME_RANDOM_CANDIDATES=(
"robbyrussell"
"agnoster"
)
ZSH_THEME_RANDOM_IGNORED=(pygmalion tjkirch_mod)
Abnormal problems
1. uninstall zsh I can't log in after root Account solution
# Input in the terminal
sudo vim /etc/passwd
# Take the first line
root:x:0:0:root:/root:/bin/zsh
# Change it to
root:x:0:0:root:/root:/bin/bash
# Put the last line
username:x:1000:1000:username,,,:/home/username:/username/local/bin/zsh
# Change it to
username:x:1000:1000:username,,,:/home/username:/username/local/bin/bash
# Save and log in root 了
Reference link :
边栏推荐
- 循环结构practice
- Can you buy 6% of financial products after opening a stock account?
- C. Recover an RBS
- 野火stm32霸道,通过固件库实现流水灯
- Explain the edge cloud in simple terms | 2. architecture
- Tiger mouth waterfall: Tongliang version of xiaohukou waterfall
- 《Route planning method for UAV in unknown environment based on improved SAS algorithm》翻译
- Spark: get the access volume of each time period in the log (entry level - simple implementation)
- pip 安装报错 error in anyjson setup command: use_2to3 is invalid.
- 2022 RoboCom 世界机器人开发者大赛-本科组(省赛)-- 第五题 树与二分图 (已完结)
猜你喜欢

各种Normalization的直观理解

25. From disk to file

Leetcode · daily question · 1184. distance between bus stops · simulation

文件操作详解

JSON file editor

How to set packet capturing mobile terminal

Decrypt "sea Lotus" organization (domain control detection and defense)

Discussion on the basic use and address of pointer in array object

Fastjson code execution cve-2022-25845

Jmeter-调用上传文件或图片接口
随机推荐
Spark: get the access volume of each time period in the log (entry level - simple implementation)
Wildfire STM32 domineering, through the firmware library to achieve water light
做好架构设计离不开SOLID五大原则
26. Code implementation of file using disk
27. Directory and file system
2022 RoboCom 世界机器人开发者大赛-本科组(省赛)-- 第三题 跑团机器人 (已完结)
使用 Fiddler Hook 报错:502 Fiddler - Connection Failed
[USENIX atc'22] an efficient distributed training framework whale that supports the super large-scale model of heterogeneous GPU clusters
JSON file editor
异或程序
云开发单机版图片九宫格流量主源码
2022 RoboCom 世界机器人开发者大赛-本科组(省赛)-- 第二题 智能服药助手 (已完结)
Various searches (⊙▽⊙) consolidate the chapter of promotion
26.文件使用磁盘的代码实现
老虎口瀑布:铜梁版小壶口瀑布
在哪家证券公司开户最好最安全 如何开户炒股票
Simple encapsulation of wechat applet wx.request
pytorch with torch.no_grad
Mysql库的操作
2022 RoboCom 世界机器人开发者大赛-本科组(省赛) CAIP 完整版题解