我正在编辑 LS_COLORS 环境变量。dircolors
列出不同文件类型的默认颜色。文件类型表示如下:
bd = (BLOCK, BLK) Block device (buffered) special file
cd = (CHAR, CHR) Character device (unbuffered) special file
di = (DIR) Directory
do = (DOOR) [Door][1]
ex = (EXEC) Executable file (ie. has 'x' set in permissions)
fi = (FILE) Normal file
ln = (SYMLINK, LINK, LNK) Symbolic link. If you set this to ‘target’ instead of a numerical value, the color is as for the file pointed to.
mi = (MISSING) Non-existent file pointed to by a symbolic link (visible when you type ls -l)
no = (NORMAL, NORM) Normal (non-filename) text. Global default, although everything should be something
or = (ORPHAN) Symbolic link pointing to an orphaned non-existent file
ow = (OTHER_WRITABLE) Directory that is other-writable (o+w) and not sticky
pi = (FIFO, PIPE) Named pipe (fifo file)
sg = (SETGID) File that is setgid (g+s)
so = (SOCK) Socket file
st = (STICKY) Directory with the sticky bit set (+t) and not other-writable
su = (SETUID) File that is setuid (u+s)
tw = (STICKY_OTHER_WRITABLE) Directory that is sticky and other-writable (+t,o+w)
如何确定文件或目录属于这些类别中的哪一个?
我为 LS_COLORS 引用的链接:
使用file
不起作用;查询目录告诉我该目录是……一个目录。但很明显,它有一个未显示的文件类型标志file
,因为某些目录有一个绝对可怕的淡绿色突出显示白色文本。使用ls -lah
也不起作用;权限字符串的第一个字母是d
,这又是不够的信息。
Ubuntu 19.10 | KDE 等离子 5.16.5 | zsh 5.7.1