「Linux」- 在操作系统安装后,进行简单设置

  CREATED BY JENKINSBOT

CentOS 7.x

# 取消「You have mail in /var/spool/mail/root」提示
echo 'unset MAILCHECK'  >> .bashrc

# 调整PS1变量
cat >> ~/.bashrc  <<EOF
export PS1="\e[01;31m\u@\h \w\e[00m""\e[34;1m\e[0m""\n""# "

# 常用命令别名
alias ll='ls -l -a --color'
alias ls='ls -a --color'
EOF

# 重新登录一下
exec su - root

# 每次安装完 CentOS 之后,执行如下命令:
yum install -y epel-release
yum install -y yum-cron yum-utils yum-cron
yum install -y sysstat procps-ng psmisc bash-completion tmux vim rsync

Debian-based

#### 添加自定义设置
cat >> ~/.bashrc <<EOF

# https://github.com/microsoft/WSL/issues/930
# LS_COLORS="$LS_COLORS":'di=0;36' ; export LS_COLORS

# 调整PS1变量
export PS1="\e[01;31m\u@\h \w\e[00m""\e[34;1m\e[0m""\n""# "

# 常用命令别名
alias ll='ls -l -a --color'
alias ls='ls -a --color'
EOF

#### 重新登录,以使配置生效
exec su - root

#### 安装常用工具,以方便系统维护管理
apt-get update
apt-get install -y vim tmux rsync tree iotop sysstat

配置源,以提高应用的安装速度(可选):

cp /etc/apt/source.list /etc/apt/source.list.backup

cat > /etc/apt/source.list <<EOF
deb https://mirrors.aliyun.com/debian  stable main contrib non-free
deb https://mirrors.aliyun.com/debian  stable-updates main contrib non-free
EOF

apt-get update

Windows 10

A better PROMPT for CMD.EXE or Cool Prompt Environment Variables and a nice transparent multi-prompt
Command-Line Reference/Prompt
Command-Line Reference/color
How to change ONLY the prompt color of the Windows command-line?
How do I change the command-line prompt in Windows?

set prompt=$p$s$d$t$_#$s

// Windows 10 已加入对 ANSI Color 支持

set prompt=$E[1;34;40m$p$s$d$t$E[0;37;40m$_#$s

如果需要持久化配置,则需要增加 PROMPT 环境变量,然后重启 Terminal 即可。