【问题标题】:Linux ls shows files with yellow background colorLinux ls 显示具有黄色背景颜色的文件
【发布时间】:2018-02-03 11:44:02
【问题描述】:

这个黄色(在 Ubuntu 上是橙色)背景颜色在 ls 中是什么意思?

neoexpert@sonderbyte:/srv/thing$ ls -l
total 32
drwxrwsr-x 2 root developers 4096 Aug 25 12:30 branches
-rw-rw-r-- 1 root developers   66 Aug 25 12:30 config
-rw-rw-r-- 1 root developers   73 Aug 25 12:30 description
-rw-rw-r-- 1 root developers   23 Aug 25 12:30 HEAD
drwxrwsr-x 2 root developers 4096 Aug 25 14:00 hooks
drwxrwsr-x 2 root developers 4096 Aug 25 12:30 info
drwxrwsr-x 4 root developers 4096 Aug 25 12:30 objects
drwxrwsr-x 4 root developers 4096 Aug 25 12:30 refs
neoexpert@sonderbyte:/srv/thing$ 

【问题讨论】:

  • 尝试/bin/ls -F 然后ls -lF
  • 在它们以那种背景颜色出现之前我做了“chmod -R g+s thing/”
  • 那是错误的,尤其是-R
  • 它用于 git 存储库,当用户创建文件时,它将具有“开发人员”组,而不是该用户的默认组。该目录应该是组开发人员的可写目录

标签: linux file colors ls


【解决方案1】:

只需尝试ls -l 即可了解(这比在这里询问要快)。

阅读ls(1) 并使用echo $LS_COLORS 查看您的LS_COLORS 环境变量

(看起来你对普通文件有可疑的sticky bit;另见this;在奇怪的文件上也试试stat(1)......)

不要在文件上使用粘性位(仅在目录上)。

顺便说一句,我怀疑为git 设置粘滞位是一个错误。

【讨论】:

  • 不,他们不是。这是来自 ls -l 的条目:-rw-rwSr-- 1 root developers 66 Aug 25 12:30 config
  • 这应该进入你的问题。 S 位可疑。
  • 谢谢。粘性位是原因:然后我做了“sudo find . -type f -print0 | sudo xargs -0 chmod g-s”
  • 请编辑您的问题以供将来参考,通过在此处提供(作为 text 即行首有四个空格)您执行的ls 命令
  • 除了使目录对特定组可写之外,还有什么常见的方法?例如,当我执行“mkdir test”时,该目录将“neoexpert”(我的默认组)作为组
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-03
  • 2017-01-06
  • 2021-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-26
相关资源
最近更新 更多