当前位置:网站首页>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 .
边栏推荐
- Strategy pattern: encapsulate changes and respond flexibly to changes in requirements
- Together, Shangshui Shuo series] day 9
- [teacher Zhao Yuqiang] use the catalog database of Oracle
- [Shangshui Shuo series together] day 10
- [set theory] relational closure (relational closure related theorem)
- Ext4 vs XFS -- which file system should you use
- The server data is all gone! Thinking caused by a RAID5 crash
- Apt update and apt upgrade commands - what is the difference?
- Beandefinitionregistrypostprocessor
- Capacity expansion mechanism of map
猜你喜欢

大二困局(复盘)

PHP笔记超详细!!!
![[teacher Zhao Yuqiang] MySQL high availability architecture: MHA](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[teacher Zhao Yuqiang] MySQL high availability architecture: MHA

伯努利分布,二项分布和泊松分布以及最大似然之间的关系(未完成)

【一起上水硕系列】Day 7 内容+Day8

2022.DAY592
![[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]
![[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[video of Teacher Zhao Yuqiang's speech on wot] redis high performance cache and persistence

Disruptor learning notes: basic use, core concepts and principles

mapbox尝鲜值之云图动画
随机推荐
最大似然估计,散度,交叉熵
MySQL startup error: several solutions to the server quit without updating PID file
[teacher Zhao Yuqiang] kubernetes' probe
Configure DTD of XML file
Final review (Day6)
项目总结--04
Beaucoup de CTO ont été tués aujourd'hui parce qu'il n'a pas fait d'affaires
[teacher Zhao Yuqiang] Flink's dataset operator
Redhat7系统root用户密码破解
[set theory] relational closure (relational closure related theorem)
[advanced pointer (2)] | [function pointer, function pointer array, callback function] key analysis + code explanation
Txt document download save as solution
Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
Solve the 1251 client does not support authentication protocol error of Navicat for MySQL connection MySQL 8.0.11
Jetson AgX Orin platform porting ar0233 gw5200 max9295 camera driver
redis 遇到 NOAUTH Authentication required
Redis encountered noauth authentication required
2022.7.2day594
Bernoulli distribution, binomial distribution and Poisson distribution, and the relationship between maximum likelihood (incomplete)
Why is the website slow to open?