CentOS7 Operation and Maintenance-System Basic Optimization Encyclopedia | Beautify Terminal | Super Detailed | Continuous Update

1. Replace Yum source

The download speed of the official Yum source is slow, and the domestic source is recommended

►Domestic source address

Alibaba Cloud | NetEase | University of Science and Technology of China

①Backup source

cd /etc/yum.repos.d/
mkdir bak
mv *.repo bak/

②Download Ali yum source

wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo

③Change the Ali yum source to the default source

mv Centos-7.repo CentOS-Base.repo

④Update the local yum cache

yum clean all && yum makecache

Second, the firewall

►Set up firewall as required

①Turn off the firewall temporarily

►It will be turned on after restart

systemctl stop firewalld.service

②Turn off the firewall permanently

►Restart will not turn on

systemctl disable firewalld.service

③Close SELinux

SELinuxIs a security subsystem, used to reduce the resources accessible by the service process in the system

►Temporary closure

setenforce 0

►Permanently closed

vim /etc/selinux/config

Found SELINUX=enforcingto be changed todisabled

Three, optimize the command prompt

① Through PS1 environment variables

►Common parameters

Serial number parameter meaning
1 \d Represents the date, the format is week, month, day
2 \H Full host name
3 \h Take only the first name of the host
4 \t Display time in 24-hour format
5 \T Display time in 12-hour format
6 \A Display time in 24-hour format
7 \ u The account name of the current user
8 \ v BASH version information
9 \w Full directory name
10 \W Use basename to get the name of the working directory, so only the last directory name will be listed
11 # What order was issued
12 $ Prompt character, if it is root, the prompt is: #, ordinary user is: $

►Color code

Serial number colour
30 black
31 red
32 green
33 yellow
34 blue
35 Pink
36 Light blue
37 white
vim /root/.bashrc
PS1='\[\e[35;1m\][\t]\[\e[33;1m\][\u@\[\e[37;20m\] \w]\[\e[34;1m\]\$: \[\e[m\]'
source /root/.bashrc
//刷新配置

②Through zsh

►Install zsh

oh-my-zsh

sudo yum install zsh
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
chmod +x install.sh
./install.sh

►Configure zsh

View more styles

vim ~/.zshrc

Find and ZSH_THEME="robbyrussell"modify it toagnoster

Guess you like

Origin blog.csdn.net/qq_42427971/article/details/113775053