前言

听说后面 CentOS 系统代码直接用的是预发布源码,也就是相当于 CentOS 成了 RedHat 的测试版,寻思着适应下其他发行版。以前经常用 Ubuntu,干脆体验下上游 Debian。
习惯了 ll ,结果居然提示命令不存在,而且一个 +x 程序居然不额外展示,稍微有点不适应,我们需要手动开启终端显色。

方法:修改 .bashrc

首先看下默认的终端特性配置文件:

1
root@xxx:~# cat .bashrc 

可见默认就有关于 ll 的相关配置,只是默认是注释状态的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval "`dircolors`"
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

我们只需要将我们要d命令相关行取消注释即可:

1
2
3
4
5
6
7
8
# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:

改完记得保存,退出重登或者使用下方命令重载配置:

1
source .bashrc

再次 ls 或者 ll 就能出现熟悉的显色了, +x 文件绿色显示,一眼就知道这是个可执行程序,这样就顺眼了。