当前位置:网站首页>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 .
边栏推荐
- Jedis source code analysis (I): jedis introduction, jedis module source code analysis
- 【一起上水硕系列】Day 7 内容+Day8
- Synthetic keyword and NBAC mechanism
- 70 shell script interview questions and answers
- 期末复习(day3)
- Bio, NiO, AIO details
- CAD插件的安装和自动加载dll、arx
- [teacher Zhao Yuqiang] Cassandra foundation of NoSQL database
- Troubleshooting of 32GB Jetson Orin SOM failure to brush
- [teacher Zhao Yuqiang] MySQL flashback
猜你喜欢

Disruptor learning notes: basic use, core concepts and principles
![[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis](/img/df/884313a69fb1e613aec3497800f7ba.jpg)
[explain in depth the creation and destruction of function stack frames] | detailed analysis + graphic analysis

Error 1045 (28000) occurs when Linux logs in MySQL: access denied for user 'root' @ 'localhost' (using password: yes)

Solve the 1251 client does not support authentication protocol error of Navicat for MySQL connection MySQL 8.0.11

Loss function in pytorch multi classification

How does win7 solve the problem that telnet is not an internal or external command
![[together Shangshui Shuo series] day 7 content +day8](/img/fc/74b12addde3a4d3480e98f8578a969.png)
[together Shangshui Shuo series] day 7 content +day8
![[teacher Zhao Yuqiang] the most detailed introduction to PostgreSQL architecture in history](/img/18/f91d3d21a39743231d01f2e4015ef8.jpg)
[teacher Zhao Yuqiang] the most detailed introduction to PostgreSQL architecture in history

mapbox尝鲜值之云图动画

PHP notes are super detailed!!!
随机推荐
Maximum likelihood estimation, divergence, cross entropy
Final review Day8
Method of finding prime number
@Import annotation: four ways to import configuration classes & source code analysis
Apache+php+mysql environment construction is super detailed!!!
PHP notes are super detailed!!!
[together Shangshui Shuo series] day 7 content +day8
The programmer shell with a monthly salary of more than 10000 becomes a grammar skill for secondary school. Do you often use it!!!
[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence
Capacity expansion mechanism of map
Txt document download save as solution
Understand the first prediction stage of yolov1
理解 期望(均值/估计值)和方差
Convolution operation in convolution neural network CNN
Analysis of the example of network subnet division in secondary vocational school
[teacher Zhao Yuqiang] Cassandra foundation of NoSQL database
Installation of CAD plug-ins and automatic loading of DLL and ARX
[teacher Zhao Yuqiang] MySQL high availability architecture: MHA
Pytorch builds the simplest version of neural network
2022.6.30DAY591