linux_bash/zsh ls(dircolor)_文件夹背景颜色去除(绿色背景)(fit to wsl)(simple solution)

绿色背景影响阅读

在这里插入图片描述

去除背景

通用配置

# remove the background color to improve the reading experience.
eval "$(dircolors -p | \
    sed 's/ 4[0-9];/ 01;/; s/;4[0-9];/;01;/g; s/;4[0-9] /;01 /' | \
    dircolors /dev/stdin)"

将其粘贴到~/.bashrc或者~/.zshrc
(用哪个shell就粘贴到对应的配置文件中)
配置完毕后保存,用
source ~/.bashrc,
source ~/.zshrc
是配置生效


for bash only

  • 将linux的shell切换为bash(依次执行以下命令)
    如果是zsh(特别时使用了oh my zsh )会导致一些异常(比如重新进入的时候失效)
  • bash
  • dircolors -p | sed 's/;42/;01/' > ~/.dircolors
  • source ~/.bashrc

效果

bash/zsh(oh my zsh)列出来的目录都不再有背景色
在这里插入图片描述

posted @ 2024-06-22 07:15  xuchaoxin1375  阅读(51)  评论(0)    收藏  举报  来源