0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linux のコンソールの色について

Posted at

ls や出力色を変える

ファイルを生成

色を変えるためのファイルを出力します。

dircolors -p > ~/.dircolors
nano ~/.dircolors   # 好みの色に編集

このファイルは、LinuxのUbuntuでは下記のように~/.dircolorsがあれば読み込むようになっている。

if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

基本色コード(文字色)

コード 説明
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 マゼンタ Magenta(紫)
36 シアン Cyan(水色)
37 White(灰色っぽい)

明るい色(90~97)

コード 説明
90 明るい黒(グレー) Bright Black / Gray
91 明るい赤 Bright Red
92 明るい緑 Bright Green
93 明るい黄 Bright Yellow
94 明るい青 Bright Blue
95 明るいマゼンタ Bright Magenta
96 明るいシアン Bright Cyan
97 明るい白 Bright White

実用例

元の色
image.png

変更後の色
image.png

  • ディレクトリを太字白文字+青背景:
DIR 01;37;44
  • 実行ファイルを太字黒文字+緑背景:
EXEC 01;30;42
  • 圧縮ファイルを太字白文字+赤背景:
*.tar 01;37;41
*.zip 01;37;41
*.gz  01;37;41
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?