002_让你的linux虚拟终端五彩缤纷(1)——LS颜色设置
[root@www ~]# man -K LS_COLORS
/usr/share/man/overrides/man1/lftp.1.gz? [ynq] y
-----------------------------------------------------------------------------------------------------------------------------------------------
Here is an easy way to set different colours for different kinds of files when using the ls command.
Add the following lines to the bottom of your ~/.bashrc file -
alias ls='ls --color'
LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'
export LS_COLORS
The first line makes ls use the --color parameter by default,
which tells ls to display files in different colours based on the
setting of the LS_COLORS variable.
The second line is the tricky one, and what I have worked out so
far has been by trial and error. The parameters (di, fi, etc.)
refer to different Linux file types. I have worked them out as
shown
di = directory
fi = file
ln = symbolic
link
pi = fifo file
so = socket
file
bd = block (buffered)
special file
cd = character
(unbuffered) special file
or = symbolic link
pointing to a non-existent file (orphan)
mi =
non-existent file pointed to by a symbolic link (visible when you
type ls -l)
ex = file which is
executable (ie. has 'x' set in permissions).
The *.rpm=90 parameter at the
end tells ls to display any files ending in .rpm in the specified
colour, in this case colour 90 (dark grey). This can be applied to
any types of files (eg. you could use '*.png=35' to make jpeg files
appear purple.) As many or as few parameters as you like can go
into the LS_COLORS variable, as long as
the parameters are separated by colons.
Using trial and error (and a little bash script I wrote... my first
one ever! :) I worked out all the colour codes, at least my
interpretation of them -
0
= default colour
1 = bold
4 = underlined
5 = flashing text
7 = reverse field
31 = red
32 = green
33 = orange
34 = blue
35 = purple
36 = cyan
37 = grey
40 = black background
41 = red background
42 = green background
43 = orange background
44 = blue background
45 = purple background
46 = cyan background
47 = grey background
90 = dark grey
91 = light red
92 = light green
93 = yellow
94 = light blue
95 = light purple
96 = turquoise
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background
These can even be combined, so that a parameter like:
di=5;31;42
in your LS_COLORS variable would make
directories appear in flashing red text with a green
background!
Setting LS_COLORS does more than just
make your ls listings look pretty (although it certainly does do
that), it is also very helpful in identifying files while wading
through a file system.
002_让你的linux虚拟终端五彩缤纷(1)——LS颜色设置的更多相关文章
- linux终端界面的字颜色设置
目录 目录 说明 PS1 颜色语法 保存设置 说明 在网上找了好多资料都不是很详细,要不就是语法有错误. 所以弄了好久才整明白了,写下来方便后面的人学习. 本人linux虚拟机版本为CentOs 6. ...
- Linux中文显示乱码?如何设置centos显示中文
Linux中文显示乱码?如何设置centos显示中文 怎么设置Linux系统中文语言,这是很多小伙伴在开始使用Linux的时候,都会遇到一个问题,就是终端输入命令回显的时候中文显示乱码.出现这个情况一 ...
- 更改linux文件夹的默认颜色
我不知道正常人看Linux下面文件夹的颜色(默认为深蓝)是不是有点晕晕的,看不清楚,反正对我这样的色弱的人来说,我看着很不爽,所以我到网上去找了一下,如果修改文件夹颜色的方法,网上真实众说纷纭,很多都 ...
- Linux修改Shell命令提示符及颜色
Linux修改Shell命令提示符及颜色 1. Linux登录过程中加载配置文件顺序: /etc/profile → /etc/profile.d/*.sh → ~/.bash_profile → ~ ...
- hadoop搭建杂记:Linux下JDK环境变量的设置(三种配置环境变量的方法)
Linux下JDK环境变量的设置(三种配置环境变量的方法) Linux下JDK环境变量的设置(三种配置环境变量的方法) ①修改/etc/profile文件 如果你的计算机仅仅作为开发使用时推荐使用这种 ...
- Linux centos 主机名颜色设置 和 别名设置
方便和乐趣写今天.至于为什么主机名颜色设置 和 别名设置放在一起写.这是因为他们的设置是在一个文件中..bashrc. .bashrc放在cd /root 这个文件夹下! 这个文件主要保存个人的一些个 ...
- c/c++ linux epoll系列3 利用epoll_wait设置timeout时间长度
linux epoll系列3 利用epoll_wait设置timeout时间长度 epoll_wait函数的第四个参数可以设置,epoll_wait函数的等待时间(timeout时间长度). 例子1, ...
- Linux 调试打印时间和颜色
Linux调试打印时间和颜色 #include <sys/time.h> #include <unistd.h> void print_time(void) { struct ...
- Linux Linux下最大文件描述符设置
Linux下最大文件描述符设置 by:授客 QQ:1033553122 1. 系统可打开最大文件描述符设置 查看系统可打开最大文件描述符 # cat /proc/sys/fs/file-max 6 ...
随机推荐
- java执行cmd命令并获取输出结果
1.java执行cmd命令并获取输出结果 import java.io.BufferedReader; import java.io.InputStreamReader; import org.apa ...
- 洛谷P1352 没有上司的舞会——树形DP
第一次自己写树形DP的题,发个博客纪念`- 题目来源:P1352 没有上司的舞会 题目描述 某大学有N个职员,编号为1~N.他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结 ...
- 高rong效chang的可持久化treap
很多人觉得可持久化treap很慢,但是事实上只是他们可持久化treap的写法不对.他们一般是用split和merge实现所有功能,但是这样会有许多不必要的分裂.其实我们可以用一种特殊的方式来实现插入和 ...
- Python下json中文乱码解决办法
json.dumps在默认情况下,对于非ascii字符生成的是相对应的字符编码,而非原始字符,只需要 #coding=utf8 import json js = json.loads('{" ...
- linux系统常见命令以及操作
2.安装xshell,安装完打开,配置回话,输入名称(随便).SSH.主机(打开linux,点击右上角电脑图标system etho进行联网,打开终端输入ifconfig回车,找到inet add地址 ...
- Mysql(一) 基本操作
一.介绍 1.数据库 数据库,通俗的讲,即为存储数据的“仓库”.不过,数据库不仅只是存储,还对所存储的数据做相应的管理,例如,访问权限,安全性,并发操作,数据的备份与恢复,日志等.实际上,我们所提及的 ...
- 认识Java标识符
标识符定义 认识Java标识符 在编程语言中,标识符就是程序员自己规定的具有特定含义的词,比如类名称,属性名称,变量名等. 问:标识符是神马? 答:标识符就是用于给 Java 程序中变量.类.方法等命 ...
- shell 脚本判断linux 的发行版本
原文vi ./Get_Dist_Name.sh #!/bin/bash Get_Dist_Name() { if grep -Eqii "CentOS" /etc/issue || ...
- libuv移植到ios
libuv官网只提供了os x的编译方法,没有IOS的.既然os x和ios的系统内核差不多,并且编译工具都是xcode,那我们只要重新指定cpu架构,就可以编译出ios版的了. 1.安装python ...
- js闭包及问题的解决
闭包定义,作用 闭包就是能够读取其他函数内部变量的函数. 作用:一个是可以读取函数内部的变量,另一个就是让这些变量的值始终保持在内存中 缺点:闭包会保存函数中的变量在内存中,导致内存消耗大 闭包会 ...