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. WPF简单导航框架(Window与Page互相调用)

    相当多的WPF程序都有着丰富的页面和功能,如何使程序在不同页面间转换并降低资源占用,选择适合自己的导航框架就很重要了.最近花了一点时间做了一个简单的导航框架,并在这个过程中对Window.Page.U ...

  2. c# NPOI 导出EXCEL

    需要引入dll文件 也可以在NuGet里面管理(推荐) 比较方便 . using System; using System.Collections.Generic; using System.Linq ...

  3. Palindrome Pairs

    Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that t ...

  4. 关于Linux x64 Oracle JDK7u60 64-bit HotSpot VM 线程栈默认大小问题的整理

    JVM线程的栈默认大小,oracle官网有简单描述: In Java SE 6, the default on Sparc is 512k in the 32-bit VM, and 1024k in ...

  5. cursor中的url整理

    浏览器中如何做才能使鼠标改变成自定义的图片,即用curosr:url属性,格式为{cursor:url('路径'),auto;}//IE,FF,chrome浏览器都可以,其中前面的url是自定义鼠标图 ...

  6. 网站fail_over测试(障害测试)

    确认Web和DB进行操作: 一:确认web: ①确认进程是否存在: ps aux|grep tomcat ②关闭tomcat: /etc/init.d/catalina_sbi stop ③重启tom ...

  7. MySql密码忘记解决方法

    1.先杀掉mysqld-nt.exe 进程,有很多种方法,最简单是在CMD里输入net stop mysql 2.CMD路径切换到MySQL的安装目录下的bin里 输入mysqld-nt.exe  - ...

  8. 记一次u盘 无法格式化、0字节、写保护的解决过程

    首先各种找方法,下载了一堆烂七八糟的东西都没能解决 后来看了这个链接的文章 http://jingyan.baidu.com/article/6079ad0e5bdec428ff86dbcd.html ...

  9. 03 Apache Solr: 安装和运行

         前面介绍了Solr在项目中的使用和构建高度可用.高度可扩展的Solr服务器的一些想法.但是光说不练假把式,现在开始,把Solr运行起来继续深入了解吧! 安装 安装JAVA Apache So ...

  10. const变量初始化问题

    在C++中const变量定义时必须进行初始化,否则无法通过编译. 初始化的方式有多种,可以通过字面值对其进行初始化,也可以通过变量对其初始化,或其他方式,只要能给const变量赋初值即可(当然初值应该 ...