search

Home  >  Q&A  >  body text

linux - CentOs ls 命令下,文件名绿色是什么意思,如何还原为灰色

不记得具体是运行了 chmod 的什么权限设置,ls 之后发现文件名变成 绿色 了,网上搜了下,绿色表示可执行权限,但是我切换了其他用户,没有该文件可执行权限,ls 下文件名还是绿色,所以不是很明白。

另外如何恢复为如下图原来的灰色呢?

谢谢。

大家讲道理大家讲道理2777 days ago1406

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:35:49

    Just change the permissions of the file and executechmod 644 index.php

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 16:35:49

    Green generally indicates an executable file because you added the executex bit to the file's mode. You cannot see the execution bit under other users because the execution x bit is also user-specific. In Unix, file user ownership is divided into user (U), group (G), and other (O). Each user can set read, write, execution and other modes respectively. If other users cannot see the executable, it means that there is no execution x bit under the other user. 执行x位。在其他用户下看不到执行位,是因为执行x位也是分用户的。在Unix中,文件用户所属分为user(U)、group(G)、other(O),每个用户所属下又可以分别设置读、写、执行等模式。出现其他用户看不到可执行,说明在other用户所属下没有执行x位。

    通过-x可以去掉执行位,还可以更细分的操作u-x g-x o-x

    chmod -x index.php

    1楼通过设置10进制的数字也可以的。反过来,增加x可以+x u+x g+x o+x

    You can remove the execution bit through -x, and you can also perform more detailed operations u-x g-x o-x

    rrreee

    On the first floor, you can also set decimal numbers. Conversely, increasing x can +x u+x g+x o+x. 🎜 🎜This area is still very basic, it is recommended to learn it systematically. 🎜

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 16:35:49

    • Green means the file has execution permission. If chmod -x filename removes the execution permission, it will no longer be green.

    • Removing the --color=auto after ls in alias will also work

    • You can also use the ls command like below

    \ls

    reply
    0
  • Cancelreply