← 返回命令列表

Linux command

dircolors 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Output shell commands

dircolors

Use a specific database file

dircolors [/path/to/dircolors.db]

Output for Bourne shell

dircolors -b

Output for C shell

dircolors -c

Print default database

dircolors -p

说明

dircolors outputs shell commands to set the LS_COLORS environment variable, which controls the colors used by ls and other tools. It reads a configuration file that maps file types and extensions to colors. Typically invoked in shell configuration files: eval "$(dircolors)".

参数

-b, --sh, --bourne-shell
Output Bourne shell commands.
-c, --csh, --c-shell
Output C shell commands.
-p, --print-database
Print the default database.

FAQ

What is the dircolors command used for?

dircolors outputs shell commands to set the LS_COLORS environment variable, which controls the colors used by ls and other tools. It reads a configuration file that maps file types and extensions to colors. Typically invoked in shell configuration files: eval "$(dircolors)".

How do I run a basic dircolors example?

Run `dircolors` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b, --sh, --bourne-shell do in dircolors?

Output Bourne shell commands.