bash 你的 LS_COLORS 是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3085834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 19:22:51  来源:igfitidea点击:

What are your LS_COLORS?

linuxbashls

提问by User1

After installing a full version of Cygwin, I open up the MinTTY shell and I like the green on black. However, when I do an 'ls', I get a dark blue for directories. It's not very readable. I found that the LS_COLORS environment variablecontrols the output of ls. Here is my current default:

安装完整版 Cygwin 后,我打开 MinTTY 外壳,我喜欢黑色中的绿色。但是,当我执行 'ls' 时,目录会变成深蓝色。它不是很可读。我发现LS_COLORS 环境变量控制 ls 的输出。这是我目前的默认设置:

no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:
or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:
*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:
*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:
*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:
*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:
*.png=00;35:*.tif=00;35:

Changing from di=00;34to di=00;94makes ls much more readable. Has anyone found other useful tweaks?

从改变di=00;34di=00;94让LS更可读。有没有人发现其他有用的调整?

回答by John Feminella

For readability purposes, instead of changing the colors that LS_COLORS produces, it's smarter to change how your terminal interprets those colors by mapping "dark blue" to a more readable RGB value. If dark blue is unreadable for you in ls, it's going to be unreadable for you everywhere.

出于可读性目的,与其更改 LS_COLORS 产生的颜色,不如通过将“深蓝色”映射到更易读的 RGB 值来更改终端解释这些颜色的方式。如果深蓝色对你来说是不可读的,那么ls它在任何地方对你来说都是不可读的。

Generally, the main time you should change LS_COLORSis whenever you want lsto know about other extensions or to treat them separately.

通常,您应该更改的主要时间LS_COLORS是您想ls了解其他扩展或单独处理它们时。

回答by laher

I always just switch background to white and main text to black, for that very reason.

出于这个原因,我总是将背景切换为白色,将正文切换为黑色。

(I'm not a Cygwin user so I'm just referring to terminal sessions generally)

(我不是 Cygwin 用户,所以我一般只是指终端会话)

I never understood the preference for dark backgrounds..

我从来不明白对深色背景的偏好。

hth