当前位置:网站首页>The most responsible command line beautification tutorial
The most responsible command line beautification tutorial
2022-07-03 05:57:00 【Leiqiu is the cutest】
Guarantee to solve everything bug Command line beautification tutorial !
Effect display
Let me show you the final effect first 
emoji beautify 、 Every time you open Welcome ,anaconda Environmental reminder , You can also broadcast The weather , Is it practical and beautiful ?Linux( Include Windows Subsystem for Linux) and MacOS Can do it , Now let me talk about the specific steps
The configuration process
1. install zsh
Use your own package manager to install zsh that will do , for example ubuntu Use
sudo apt-get install zsh
CentOS Use
sudo yum -y install zsh
2. set default shell
Default for different users shell, By /etc/passwd Document controlled , So you can edit passwd File to change the default shell.
sudo vim /etc/passwd

Modify... In the file root Line and own user line , take /bin/bash It is amended as follows /bin/zsh, then Esc, Input :wq, Press enter to save .
3. install oh-my-zsh
oh-my-zsh yes github An open source project on , It can be easily managed zsh The theme of , plug-in unit , Beautification and so on , But because of raw.github.com Often because of some DNS The problem cannot be opened , In this step, it is recommended to install locally . First go to the project github Address :https://github.com/ohmyzsh/ohmyzsh/, download zip File or use git clone Download the source code .
Download and enter ohmyzsh Under folder tools Folder , You can see that there are several sh file , For execution without installation
sudo chmod a+x *.sh
./install.sh
that will do .
installed ohmyzsh when , If you haven't set the default shell, Will remind you whether to default shell Switch to a zsh, When finished, you can see ohmyzsh The default interface for .
4. Install Fonts
About Fonts , Most articles do not describe . The problem occurs when installing the theme , If you are Ubuntu/CentOS, This is bound to happen
this image drill stone Do you ?
this image lock Do you ?
Like a * Oh ! I studied carefully for this Unicode Knowledge about , This happens because your computer lacks fonts that contain these icons . But I found my macbook These icons can be displayed well at the beginning , So I started from macOS Search one by one in the font book of , Finally let me find this named MesloLGS NF The font of , This font contains many common small icons , Holding it inside, I also found the lock 、 Diamonds, etc powerlevel10k Icons needed . This font file can be downloaded by Baidu , I also uploaded the file to Baidu online disk , If necessary, you can also download
( link :https://pan.baidu.com/s/1a8tCsDDW1917Ce3fcgkxag Extraction code :zxy1 ).
Put the font file in your linux Installation in system , If it is a graphical interface, double-click directly to install , If it is a remote server , In the local windows It can be installed on the computer ( After all, always use ssh Connect ).
5. install powerlevel10k The theme
powerlevel10k yes oh-my-zsh A theme of , It's the last version powerlevel9k Upgraded version , Faster response while retaining functionality . its github The project address is https://github.com/romkatv/powerlevel10k, download powerlevel10k To your oh-my-zsh Under the theme directory
cd ~/.oh-my-zsh
git clone https://github.com/romkatv/powerlevel10k.git
Now modify ohmyzsh Configuration file for
vim ~/.zshrc
take ZSH_THEME Change the line to powerlevel10k/powerlevel10k( Because the theme is powerlevel10k Under folder powerlevel10k.zsh-theme), As shown in the figure below .
Save and exit , Refresh zsh The configuration file
source ~/.zshrc
At this time, the following interface should appear , Just configure it according to your preferences . If you accidentally close this interface , Or it doesn't matter if you want to revise it later , You can enter... At any time
p10k configure
To reset preferences .
6.anaconda part ( Configure as appropriate )
If it has been installed before anaconda, Want to achieve the function of displaying the current environment at the beginning of the article , Just input
conda init zsh
source ~/.zshrc
You can complete the configuration .
7. The weather today ( Configure as appropriate )
This part of the content belongs to me , In fact, it's a simple curl To carry out API call . The code is as follows , The parts that need to be modified manually have been marked
City ID Can be obtained from https://blog.csdn.net/wu9797/article/details/78768938 lookup
#!/bin/zsh
# Indicates that... Is used zsh Command line
weather_json=$(curl -s http://www.tianqiapi.com/api\?version=v61\&appid=" Yours APP ID"\&appsecret=" Yours API ID, Need to be in tianqiapi.com apply "\&cityid=" The city you want ID, You can find it in Baidu ")
# Use curl Order to find the weather in Chengdu ,-s Indicates silent mode
name=`whoami`
city=`echo $weather_json | jq -r '.city'`
weather=`echo $weather_json | jq -r '.wea'`
temp_high=`echo $weather_json | jq -r '.tem1'`
temp_low=`echo $weather_json | jq -r '.tem2'`
wind_direction=`echo $weather_json | jq -r '.win'`
wind_speed=`echo $weather_json | jq -r '.win_speed'`
wet=`echo $weather_json | jq -r '.humidity'`
word=" Hello! ,$name, welcome back . today $city What's the weather like $weather, The highest temperature is $temp_high degree , Is the minimum $temp_low degree . The wind direction is $wind_direct ion, The wind speed is $wind_speed, The humidity is $wet, I hope your work is going well "
echo $word
Edit this file , I'm going to call it begin.sh Place it in /usr/local/bin Under the folder , Add executable permissions to the file
sudo chmod a+x begin.sh
And then edit it again zshrc file , Add a line at the end of the file begin.sh
Save and open the command line again .
边栏推荐
- Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
- There is no one of the necessary magic skills PXE for old drivers to install!!!
- [explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis
- [together Shangshui Shuo series] day 7 content +day8
- Bio, NiO, AIO details
- The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
- 为什么网站打开速度慢?
- Kubernetes resource object introduction and common commands (V) - (configmap)
- 【一起上水硕系列】Day 7 内容+Day8
- redis 无法远程连接问题。
猜你喜欢
![[teacher Zhao Yuqiang] MySQL flashback](/img/93/75998e28fd309880661ea723dc8de6.jpg)
[teacher Zhao Yuqiang] MySQL flashback

Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
![Together, Shangshui Shuo series] day 9](/img/39/c1ba1bac82b0ed110f36423263ffd0.png)
Together, Shangshui Shuo series] day 9
![[teacher Zhao Yuqiang] use Oracle's tracking file](/img/0e/698478876d0dbfb37904d7b9ff9aca.jpg)
[teacher Zhao Yuqiang] use Oracle's tracking file
![[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]](/img/b0/aa5dce0bb60c50eea907de9e127d6c.jpg)
[minesweeping of two-dimensional array application] | [simple version] [detailed steps + code]

理解 期望(均值/估计值)和方差

Code generator - single table query crud - generator

Jedis source code analysis (I): jedis introduction, jedis module source code analysis

Analysis of Clickhouse mergetree principle

Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
随机推荐
Txt document download save as solution
[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation
How to create and configure ZABBIX
[teacher Zhao Yuqiang] redis's slow query log
Jedis source code analysis (I): jedis introduction, jedis module source code analysis
多线程与高并发(7)——从ReentrantLock到AQS源码(两万字大章,一篇理解AQS)
Introduction to redis using Lua script
Mapbox tasting value cloud animation
JDBC connection database steps
大二困局(复盘)
Redis encountered noauth authentication required
Exception when introducing redistemplate: noclassdeffounderror: com/fasterxml/jackson/core/jsonprocessingexception
Ansible firewall firewalld setting
[teacher Zhao Yuqiang] Cassandra foundation of NoSQL database
[advanced pointer (1)] | detailed explanation of character pointer, pointer array, array pointer
[teacher Zhao Yuqiang] MySQL high availability architecture: MHA
2022.7.2day594
70 shell script interview questions and answers
Synthetic keyword and NBAC mechanism
Solve the problem of automatic disconnection of SecureCRT timeout connection