与你分享
互联网的方方面面

解决Debian 10系统ls命令不显示颜色以及无ll命令

老王最近开始转向Debian系统,目前新开的VPS都开始使用Debian 10系统了。

使用过程中发现了几点问题:

  • ls命令不显示颜色
  • ll命令提示不存在

因为之前都是使用的CentOS以及Ubuntu系统,所以比较习惯于ls显示颜色以及ll命令的。这里记录一下自己的解决办法。

我们可以通过修改/root/.bashrc文件来实现ls显示颜色以及ll命令:

以上文件的默认内容如下:

# ~/.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'

这里我们将9-12行的注释去掉,修改后如下:

# ~/.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'

然后执行以下命令即可生效:

source ~/.bashrc

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《解决Debian 10系统ls命令不显示颜色以及无ll命令》
文章链接:https://wph.im/120.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。