5
當我做「ls」時,它會用顏色編碼列出文件和文件夾。我無法在任何地方找到此編碼的翻譯。我知道一些是文件,一些是目錄,但我在這裏有三種顏色。在Mac終端中,「ls」的顏色編碼結果是什麼意思?
任何人都知道翻譯的地方?有許多帖子說如何激活編碼,但現在在哪裏看到定義。
當我做「ls」時,它會用顏色編碼列出文件和文件夾。我無法在任何地方找到此編碼的翻譯。我知道一些是文件,一些是目錄,但我在這裏有三種顏色。在Mac終端中,「ls」的顏色編碼結果是什麼意思?
任何人都知道翻譯的地方?有許多帖子說如何激活編碼,但現在在哪裏看到定義。
看man ls
,如果你想了解如何改變它們,但這裏搜索字符串LSCOLORS
的基礎:
LSCOLORS The value of this variable describes what color to use
for which attribute when colors are enabled with
CLICOLOR. This string is a concatenation of pairs of the
format fb, where f is the foreground color and b is the
background color.
The color designators are as follows:
a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background
Note that the above are standard ANSI colors. The actual
display may differ depending on the color capabilities of
the terminal in use.
The order of the attributes are as follows:
1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky bit
11. directory writable to others, without sticky
bit
The default is "exfxcxdxbxegedabagacad", i.e. blue fore-
ground and default background for regular directories,
black foreground and red background for setuid executa-
bles, etc.
所以,默認爲:
directories: blue on default background
symlink: magenta on default background
socket: green on default background
pipe: brown on default background
等在
謝謝大衛!如果有命令識別ls中返回的項目的類型,您是否知道? – 2013-02-11 23:46:54
如果你的意思是在目錄列表中,ls的-F選項就是你想要的。如果您的意思是檢查每個文件以查看它是什麼,則'文件'命令將識別它。如果您不希望它取消引用符號鏈接,請使用文件中的「-h」開關。 – 2013-02-11 23:51:51