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. 更改XAMPP中MySQL数据库的端口号

    更改XAMPP中MySQL数据库的端口号 如果电脑上已安装MySql数据库,还想用XAMPP中自带的数据库就需要更改XAMPP中数据库的端口号,避免和已安装的数据库冲突.本例以更改为3307端口号为例 ...

  2. AOP (Aspect-OrientedProgramming)面向切面编程

    AOP OOP 面向对象编程 适合自上向下,却不适合自左向右 AOP把软件系统分为两个部分:核心关注点和横切关注点.业务处理的主要流程是核心关注点,与之关系不大的部分是横切关注点. 横切关注点的一个特 ...

  3. mongodb sharding 简单部署记录

    创建目录 mkdir {mongos,config,shard1,shard2} mkdir -p mongos/{data,log} mkdir -p config/{data,log} mkdir ...

  4. 处理sevenzipsharp 检查密码函数的Bug

    using (SevenZipExtractor extr = new SevenZipExtractor(tbPackagePath.Text, "www.pc6.com")) ...

  5. AndroidStudio安装教程(Windows环境下)

    AndroidStudio官网下载:http://android-studio.org/    可以更具自己喜欢的版本下载,个人推荐2.2版本以上,因为开发和运行效率快,高很多. Android St ...

  6. ffmpeg总结整理

    ffmpeg总结整理参考链接:    http://www.cnblogs.com/youngt/p/5754415.html

  7. 简洁的java代码

    最近在codewars上刷题,学习到了不少简洁优雅的代码. codewars和leetcode都是刷题网站,codewars的题目难度分类比较广,适合各种不同水平的coder刷题. 刷完题后,看一下其 ...

  8. Nginx-->基础-->理论-->002:Nginx进程介绍

    一.Nginx进程介绍

  9. Nginx-->基础-->排错-->nginx错误总结

    一.启动时错误 1.错误提示: 2016/11/16 17:36:41 [emerg] 2458#2458: getpwnam("nginx") failed 查看错误日志文件内容 ...

  10. 【openresty】向lua代码中传递参数

    前面介绍FormInputNginxModule模块时,明白了openresty如何获取post提交的数据. 然后,如果需要通过lua处理这些数据,需要把数据作为参数传递到lua中,lua获取了这些数 ...