LS_COLORS

授权协议 View license
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 勾学博
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Table of contents

LS_COLORS

This is a collection of extension:color mappings, suitable to use as yourLS_COLORS environment variable. Most of them use the extended color map,described in the ECMA-48 document; in other words, you'll need a terminalwith capabilities of displaying 256 colors.

As of this writing, around 300 different filetypes/extensions is supported.That's indeed a lot of extensions, but there's a lot more! Your help is greatlyappreciated.

Fork this project on github, add the extensions you are missing, and send a pullrequest.

Some guidelines:

For files that usually ends up next to each other, like html, css and js,try to pick colors that fits in nicely together. Filetypes with multiplepossible extensions, like htm and html, should have the same color.

What does it look like?

Here's a screenshot (font and minor color shades, of course, depend on terminal and its configuration):

Dependencies

You need GNU dircolors and a compatible directory listing tool, such as GNUls. Both are available in GNU coreutils.

Installation

An installation script is provided with this repository:

$ mkdir /tmp/LS_COLORS && curl -L https://api.github.com/repos/trapd00r/LS_COLORS/tarball/master | tar xzf - --directory=/tmp/LS_COLORS --strip=1
$ ( cd /tmp/LS_COLORS && sh install.sh )
To enable the colors, add the following line to your shell's start-up script:

For Bourne shell (e.g. ~/.bashrc or ~/.zshrc):
  . "~/.local/share/lscolors.sh"

For C shell (e.g. ~/.cshrc):
  . "~/.local/share/lscolors.csh"
$

Arch Linux

Arch Linux users can install the lscolors-git package from the AUR for easyintegration with bash, csh, or zsh.

Information for Developers

There's a library I've written that lets you use various LS COLORS onarbitrary files and directories. A simple implementation can be found here.

Using this, you can do

find $HOME -maxdepth 1  | ls_color

mpc search artist Laleh | ls_color

... and so on.

Legal

© Copyright 2014-2020 Magnus Woldrich.

This program is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE. See the Perl Artistic License for more details.

This program is free software: you can redistribute it and/or modify it underthe terms of the Perl Artistic License as published by the Perl Foundation,either version 1.0 of the License, or (at your option) any later version.

You should have received a copy of the Perl Artistic License alongwith this program. If not, see http://www.perlfoundation.org/artistic_license_1_0.

  • ls命令一直是黑底白字很难受,网上找了很多方法,总结了一下 linux下shell启动时会运行用户文件夹(~/)下的.bash_profile文件其中的内容会运行相同目录下的.bashrc文件,如果系统中没有.bash_profile文件,可自己创建,添加以下代码 if [ -f "$HOME/.bashrc" ];then     . "$HOME/.bashrc" fi 大致是寻找到.bash

  • 今天在运行sudo chroot .的时候,系统提示: bash: /dev/null: No such file or directory 然后运行ls命令的时候,系统提示: ls: unrecognized prefix: rs ls: unparsable value for LS_COLORS environment variable 现在的文件目录都是统一的白色。 在google上查找了

  • [b]add belowing in your .bashrc[/b] alias l.='ls -d .* --color=tty' alias ll='ls -l --color=tty' alias ls='ls --color=tty' alias vi='vim' LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=

  • ls指令显示的文件,可以通过设置环境变量LS_COLORS,修改不同类型文件显示的颜色。LS_COLORS可以通过指定文件设定,如: shell terminal$dircolors -b .mydircolor 若未指定,则读取默认的值,可以通过如下指令查看。 shell terminal$dircolors -p   更多信息请通过 man dircolors(1)查看。 自己定制ls输出的文

  • 在控制台下,用ls,就会发现,shell将不同类型的文件项目显示为不同的颜色。者可以提高效率,不用ls -l便能大概的把各个文件的类型情况了解一下。 你有没有想过更改这个着色配置呢? 其实,在/etc下有一个DIR_COLORS的文件,这是一个着色控制的模版。现将这个模版拷出来。如果想让这个配置在root用户下生效,边拷到 /root下;如果想在abc(例子)用户下生效,便拷到/home/abc/

  • # Configuration file for dircolors, a utility to help you set the # LS_COLORS environment variable used by GNU ls with the --color option. # Copyright (C) 1996-2015 Free Software Foundation, Inc. # Co

  • # Below are the color init strings for the basic file types. A color init # string consists of one or more of the following numeric codes: # Attribute codes:  # 00=none 01=bold 04=underscore 05=blink

  • 好久没碰我的服务器了,今天远程上去一看 出现了一个问题 ls: unparsable value for LS_COLORS environment variable ls: unrecognized prefix: rs 网上一搜索,使用 echo $LS_COLORS 得到结果如下: rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35

  • 转载自: 网络 linux命令ls会显示出文件的颜色, 系统约定的默认颜色含义如下: 白色:表示普通文件 蓝色:表示目录 绿色:表示可执行文件 红色:表示压缩文件 浅蓝色:链接文件 红色闪烁:表示链接的文件有问题 黄色:表示设备文件 灰色:表示其他文件 如果需要修改的话, 可以在环境变量$LS_COLORS上修改就行. 想永久保存在~/.bashrc里修改. 默认的是: echo $LS_COLO

  • ls命令显示的颜色由LS_COLORS全局变量决定, 在~/.bashrc的最后加一句: $export LS_COLORS=${LS_COLORS}'di=01;36': 然后执行source .bashrc就可以生效了。 设置格式如下: LS_COLORS='文件匹配符=字的底色;字的颜色;背景颜色:'。 背景颜色可以省略。 样例: 1)设置tar.gz文件为红色:LS_COLOR

相关阅读

相关文章

相关问答

相关文档