今天在使用 Xshell 的连接 VPS 的时候,发现命令行 ls ​输出没有配色,就像这样

image

我记得有些 VPS 上面 ls ​输出是有配色的,就像这样

image

考虑到两台系统不同,便进行了再次测试,发现 Ubuntu 系统的机器都会有配色,而 Debian 的没有,出于美观和方便,我就想让 Debian 的机器也有配色,经过查验,是由于Debian缺少.profile.bashrc配置,而我们可以使用.bash_profile配置获得类似效果,在经过一番折腾,得到了如下两种方案(其实区别不大)。


image


image

使用演示

1
2
3
4
5
6
#登录需要增加配色的VPS,这里以root用户为例
cd ~
方案一
wget https://getfile.top/Documents/.bash_profile-Debain && mv .bash_profile-Debain .bash_profile && source ~/.bash_profile
方案二
wget https://getfile.top/Documents/.bash_profile-all && mv .bash_profile-all .bash_profile && source ~/.bash_profile

第一种是从 Ubuntu 的 VPS 中 /root/.bashrc 文件扒的,第二种是从网上找的(出处)。

大家看着用。