在Ubuntu服务器中更改terminal颜色

我想改变颜色。 淡绿色的文件名称上的石灰绿色光芒正在杀死我的眼睛。

我不知道是否使用xtermgnome或其他,但我想改变默认的配色scheme(最好是对我的angular膜不太冒犯),并保持改变(更新我的用户configuration文件)。

颜色很好,但有时它使文本无法读取。 如果我不能有漂亮的颜色,我会select没有颜色,标准的黑白。

您需要在~/.dir_colors (系统范围/etc/dir_colors )中configurationLS_COLORS导出,

看到这里的文件: http : //manpages.ubuntu.com/manpages/karmic/man5/dir_colors.5.html

::编辑::

为了让它坚持下去:

  1. 附加到你的~/.bashrc
    如果[“$ TERM”!=“dumb”]; 然后
       [-e“$ HOME / .dir_colors”] && 
       DIR_COLORS =“$ HOME / .dir_colors”[-e“$ DIR_COLORS”] ||
       DIR_COLORS = “” 
       eval“`dircolors -b $ DIR_COLORS`” 
      别名ls ='ls --color = auto'
    科幻
  1. 创build/编辑你的~/.dir_colors

    例如用dircolors --print-database > .dir_colors

  2. 然后用以下方法强制读取.bashrc文件:

    $: source ~/.bashrc

  3. 一切都应该漂亮。

如何改变Linux shell中文件列表的颜色

概要

Linux交互式terminal(也称为sshterminal,konsole或控制台login)自动为“文件”,“目录”,“硬链接”,“软链接”,“pipe道”,“插槽”,“文件系统”等select颜色。当您键入'ls'列出文件内容时,请查看显示的这些颜色。 目录通常是蓝色的,文件通常是浅灰色的。 不同的前景/背景颜色用于各种文件系统对象。

问题:

当你input“ls”时,你的terminal显示目录链接为深蓝色,并且你希望它是浅青色,所以你可以更好地阅读它。

使用你最喜欢的编辑器,打开这个文件:/ etc / DIR_COLORS你应该看到这样的东西:

 #NORMAL 00 # no color code at all #FILE 00 # regular file: use no color at all RESET 0 # reset to "normal" color DIR 01;34 # directory LINK 01;36 # symbolic link. (If you set this to 'target' instead of a # numerical value, the color is as for the file pointed to.) MULTIHARDLINK 00 # regular file with more than one link FIFO 40;33 # pipe SOCK 01;35 # socket DOOR 01;35 # door BLK 40;33;01 # block device driver CHR 40;33;01 # character device driver ORPHAN 01;05;37;41 # orphaned syminks MISSING 01;05;37;41 # ... and the files they point to SETUID 37;41 # file that is setuid (u+s) SETGID 30;43 # file that is setgid (g+s) CAPABILITY 30;41 # file with capability STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable 

注意第4行开始:“DIR”。 这是您的目录链接的颜色。 如果您想了解更多关于代码是什么意思访问这个网站的信息:

http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html

注意DIR的代码是'01; 34'。 34意味深蓝。 你可能会试图只在它所在的位置编辑这个文件/ etc / DIR_COLORS。 不要这样做。 因为那样你就会改变每个login到这台计算机的人的颜色。 您必须在自己的目录中复制这个副本,这样只会影响您的login。

如何更改您的用户的目录颜色

使用以下命令将/ etc / DIR_COLORS复制到您的主目录中:

 cp /etc/DIR_COLORS /home/yourusername/.dir_colors 

在你最喜欢的编辑器中打开/home/yourusername/.dir_colors并编辑如下所示的行:

 DIR 01;34 # directory 

并改变它到这个;

 DIR 01;36 # directory 

34是蓝色的代码,36是青色的代码。 保存/home/yourusername/.dir_colors您必须注销/login才能使设置生效。 (采购您的configuration文件不会吸引更改)。 一旦你注销/login,运行命令'ls'。 目录应该显示为青色而不是蓝色。 喜欢这个:

之前:

在这里输入图像说明

后:

在这里输入图像说明

假设你正在使用gnome-terminal,你可以select编辑>configuration文件…并select当前的configuration文件(例如默认)并点击编辑(或者点击新build并input新configuration文件的名称 – 如果你这样做,那么你之后需要将其设置为“启动新terminal时使用的configuration文件”)。 现在,您可以单击“颜色”选项卡,您可以在其中设置背景和前景颜色,并操作调色板(包括在内置scheme中进行select)。

你可以尝试白色的前景/背景黑色scheme和Tango调色板(颜色有点静音)。