Linux command ls basically use the file /etc/DIR_COLORS or /etc/DIR_COLORS.xterm to define the colors used, in terms of different types of terminal windows.

You can change the definitions directly in these files to alter the colors to meet your expectation. However sometimes you do not have the write access to /etc/ thus you can set an environment variable named LS_COLORS to achieve this goal. A tool named dircolors could be used to translate the definitions in /etc/DIR_COLORS to the commands to set the LS_COLORS environment variable. Use dircolors --help to see the synopsis.

For example, I am using csh, thus I would use:

dircolors -c /etc/DIR_COLORS

Then the command gives:

setenv LS_COLORS 'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:'

Modify this value and write it to .cshrc to take effect after next sourcing of .cshrc.

Read /etc/DIR_COLORS for the definitions of each value.

Changing the Color of Linux ls Command 改变Linux的ls命令显示的颜色的更多相关文章

  1. Linux:-bash: ***: command not found,系统很多命令都用不了

    系统:64位RHEL6 突然之间linux很多命令都用不了,均提示没有此命令. 这应该是系统环境变量出现了问题导致的. 出现这种可能性的原因有很多,大多数是因为,安装了新的软件要配置环境变量,但是没有 ...

  2. liunx -bash:ls:command not found,执行命令总是报找不到

    解决办法: 使用绝对命令vi打开profile /bin/vi  /etc/profile 添加: export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/ ...

  3. 改变input标签中placeholder显示的颜色

    ::-webkit-input-placeholder { /* WebKit browsers */ color: #A9A9A9; } :-moz-placeholder { /* Mozilla ...

  4. 在Linux中让echo命令显示带颜色的字

    echo显示带颜色,需要使用参数-e 格式如下: echo -e "\033[字背景颜色;文字颜色m字符串\033[0m" 例如: echo -e "\033[41;37 ...

  5. 15 Basic ‘ls’ Command Examples in Linux

    FROM: http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ ls command is one of the most fr ...

  6. Linux:-bash: ***: command not found

    Linux:-bash: ***: command not found,系统很多命令都用不了,均提示没有此命令. 突然之间linux很多命令都用不了,均提示没有此命令. 这应该是系统环境变量出现了问题 ...

  7. 在Linux中让文本显示带颜色的字。

    在linux中让echo命令显示带颜色的字需要使用参数-e 格式:echo -e "\33[字体背景颜色:文字颜色m字符转\033[0m" 注: 1.字体背景颜色和文字颜色之间是英 ...

  8. 002_让你的linux虚拟终端五彩缤纷(1)——LS颜色设置

  9. Linux shell command学习笔记(一)

    Shell的种类有很多种,例如CSH,Bourne Shell,Korn Shell.在现在的大多数Linux发行版中,默认的Shell一般都是Bourne again shell(bash). &l ...

随机推荐

  1. 使用命令行执行webpagetest进行测试

    背景 使用webpagetest进行性能分析,需要一个一个url的去执行,需要人为去等,比较繁琐.而api很好的解决了这个问题,可以通过命令行等执行测试,也可以写成一个常规脚本,针对每个版本的常规ur ...

  2. Java 字符串拼接 五种方法的性能比较分析 从执行100次到90万次

    [请尊重原创版权,如需引用,请注明来源及地址] > 字符串拼接一般使用“+”,但是“+”不能满足大批量数据的处理,Java中有以下五种方法处理字符串拼接,各有优缺点,程序开发应选择合适的方法实现 ...

  3. NLua - 基于Lua的C#脚本引擎

    Nlua NLua is the bind between Lua world and the .NET world. NLua is a fork of project LuaInterface ( ...

  4. Call requires API level 21(Current min is 16)

    Call requires API level 21(Current min is 16) Android开发中,遇到类似这种问题,如何处理? 一种办法是提升sdk最低版本到21,在Android s ...

  5. 2016CCPC 合肥--最大公约数//每一年通向它的路上,多少人折戟沉沙,多少人功败垂成,有人一战成名,有人从头再来。

    有这样一个有关最大公约数的函数:函数 f(x, y): { c=0 当 y>0: { c +=1 t = x % y x = y y = t } 返回 c * x * x} 给出三个正整数n,m ...

  6. zabbix微信告警实践

    首先你得有个企业号!!!具体操作步骤可以参考http://itnihao.blog.51cto.com/1741976/1733245,里面写的很详细就不重复了. 微信公众号注册并配置完成后,还需要让 ...

  7. 【经验】Maven Tomcat8+ 实现自动化部署

    1.配置tomcat-users.xml 首先在Tomcat里配置deploy的用户(tomcat根目录/conf/tomcat-users.xml): <role rolename=" ...

  8. windows 8.1 下蓝屏报错:SYSTEM_SERVICE_EXCEPTION(NETIO.SYS)的解决办法

         大概2周前,电脑突然蓝屏了,我上网查了一下解决办法,因为大部分内容是英文的,所以我只大概看了下,看到这个问题好像是由于软件冲突造成的,于是就把小红伞去掉了,而那天电脑也真的没有再蓝屏(之前大 ...

  9. mysql主从不一致解决方法

    方法一:忽略错误后,继续同步 该方法适用于主从库数据相差不大,或者要求数据可以不完全统一的情况,数据要求不严格的情况 stop slave; #表示跳过一步错误,后面的数字可变 set global ...

  10. Thrift 2中get用法的详细解析

    Thrift2相比于Thrift 1改动较大,这里不去描述改动的地方,但是它的改动确实比Thrift1方便了很多.但是不能理解的是Thrift2网上的资料和文档相当的少,就以Thrift2操作Hbas ...