当前位置:网站首页>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 .
边栏推荐
- Use telnet to check whether the port corresponding to the IP is open
- 大二困局(复盘)
- Apple submitted the new MAC model to the regulatory database before the spring conference
- mapbox尝鲜值之云图动画
- 为什么网站打开速度慢?
- Btrfs and ext4 - features, strengths and weaknesses
- Jedis source code analysis (II): jediscluster module source code analysis
- MySQL 5.7.32-winx64 installation tutorial (support installing multiple MySQL services on one host)
- NG Textarea-auto-resize
- Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
猜你喜欢

pytorch 多分类中的损失函数
![[teacher Zhao Yuqiang] RDB persistence of redis](/img/cc/5509b62756dddc6e5d4facbc6a7c5f.jpg)
[teacher Zhao Yuqiang] RDB persistence of redis

PHP笔记超详细!!!

PHP notes are super detailed!!!

Core principles and source code analysis of disruptor

Analysis of Clickhouse mergetree principle

Apache+PHP+MySQL环境搭建超详细!!!

Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)

Clickhouse learning notes (2): execution plan, table creation optimization, syntax optimization rules, query optimization, data consistency

Apache+php+mysql environment construction is super detailed!!!
随机推荐
【无标题】
Clickhouse learning notes (2): execution plan, table creation optimization, syntax optimization rules, query optimization, data consistency
Apache+PHP+MySQL环境搭建超详细!!!
Troubleshooting of 32GB Jetson Orin SOM failure to brush
[Zhao Yuqiang] deploy kubernetes cluster with binary package
[teacher Zhao Yuqiang] index in mongodb (Part 2)
2022.DAY592
Final review (Day5)
88. Merge two ordered arrays
Clickhouse learning notes (I): Clickhouse installation, data type, table engine, SQL operation
Ext4 vs XFS -- which file system should you use
Qt读写Excel--QXlsx插入图表5
Multithreading and high concurrency (7) -- from reentrantlock to AQS source code (20000 words, one understanding AQS)
Alibaba cloud OOS file upload
Life is a process of continuous learning
Ansible firewall firewalld setting
Pytorch dataloader implements minibatch (incomplete)
Understand one-way hash function
How to create your own repository for software packages on Debian
[teacher Zhao Yuqiang] MySQL high availability architecture: MHA