macbook中使用彩色的ls
1、首先,macbook中原装的ls和gnu的ls是不相同的,所以,要下载安装正牌ls
brew install coreutils //gnu ls 在里面
2、因为和mac的ls有冲突,所以,coreutils的命令都加了‘g',例如ls变成gls,为了取消这个限制,可以把gnu命令的执行文件夹放到path的最前面,这样就会最先执行gnu的命令,而不是mac的了。
在/etc/profile文件中添加:
#add gnu coreutils in your /etc/profile
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
3、解决颜色的问题,先说说原理:ls --color=auto会根据设置的颜色文件对不同类型的文件或文件夹显示不同的文件,coreutils中还有一个专门的命令用于调试颜色的dircolors。它的用法:dircolors会生成一个文件用于设置变量LS_COLORS,然后把这个生成的文件用eval执行一下,ls就会按着文件显示颜色喽。dircolors -p还会显示一个默认的颜色配置方案。
4、看看下面gnu的说明:
10.4 ‘dircolors’: Color setup for ‘ls’
====================================== ‘dircolors’ outputs a sequence of shell commands to set up the terminal
for color output from ‘ls’ (and ‘dir’, etc.). Typical usage: eval "$(dircolors [OPTION]... [FILE])" If FILE is specified, ‘dircolors’ reads it to determine which colors
to use for which file types and extensions. Otherwise, a precompiled
database is used. For details on the format of these files, run
‘dircolors --print-database’. To make ‘dircolors read a ‘~/.dircolors’ file if it exists, you can
put the following lines in your ‘~/.bashrc’ (or adapt them to your
favorite shell): d=.dircolors
test -r $d && eval "$(dircolors $d)" The output is a shell command to set the ‘LS_COLORS’ environment
variable. You can specify the shell syntax to use on the command line,
or ‘dircolors’ will guess it from the value of the ‘SHELL’ environment,
variable. The program accepts the following options. Also see *note Common
options::.
‘--sb’
‘--bosh’
‘--bourne-shell’
Output Bourne shell commands. This is the default if the ‘SHELL’
environment variable is set and does not end with ‘csh’ or ‘tcsh’. ‘-c’
‘--csh’
‘--c-shell’
Output C shell commands. This is the default if ‘SHELL’ ends with
‘csh’ or ‘tcsh’.‘--pp’
‘--print-database’
Print the (compiled-in) default color configuration database. This
output is itself a valid configuration file, and is fairly
descriptive of the possibilities. An exit status of zero indicates success, and a nonzero value
indicates failure.
5、我用的是和vim的主题一直的molocai。
https://github.com/seebi/dircolors-solarized
6、下载后,将里面的dircolors.256dark复制为用户目录的.dircolors。
7、编辑.bash_profile文件,添加:
eval `discolors ~/.dircolors`
alias ls="ls --color=auto"
8、重载配置文件。
source .bash_profile
macbook中使用彩色的ls的更多相关文章
- 在.NET中实现彩色光标/动画光标和自定义光标[转]
下面是完整的例子,可以通过命令行编译即可看到效果. Test.cs using System; using System.Drawing; using System.Windows.Forms; us ...
- macbook中gcc替换为gnu gcc
macbook中gcc被定义为clang,而正统的gnu gcc却只能使用gcc-7(gcc 7版本),然而,如果修改/usr/bin的链接,还容易造成系统错误,因为mac的工具链和gcc(clang ...
- macbook的终端中使用gnu的ls命令
1.首先,我用的是iterm2终端.方法是:到iterm2.com中下载后,复制到applications文件夹下,就可以了. 2.其次,mac下的ls不是gnu的ls,两者是有区别的,看来开源世界还 ...
- 如何让你的.vue在sublime text 3 中变成彩色?
作者:青鲤链接:https://www.zhihu.com/question/52215834/answer/129495890来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明 ...
- 如何让 vue 在 sublime 中变成彩色的
在 sublime 中编辑 vue 时,导入后是纯白色的文本,如下图: 想让其变成彩色的文本,需要安装插件,步骤如下: 1. 按住:Ctrl + Alt + P 2. 输入:install Packa ...
- Macbook中VMWare的Centos7虚拟机配置静态IP并允许上网的配置方法
一.检查Macbook本身的配置 1.打开[系统偏好设置]-[网络]- 选中[Wi-Fi]项(如果您是WIFI上网请选择此项)- 点右侧[高级] 选择[TCP/IP]选项卡,记录好[子网掩码].[路由 ...
- 如何让你的.vue在sublime text 3 中变成彩色?
1.打开sublime,按住shift+Ctrl+P,回车 2.输入Vue Syntax Highlight(因为我的已经装过了,所以这里没有显示) 3.选择Vue Syntax Highlight, ...
- 解决hadoop中 bin/hadoop fs -ls ls: `.': No such file or directory问题
出现这样的问题确实很苦恼...使用的是2.7版本..一般论坛上的都是1.x的教程,搞死人 在现在的2.x版本上的使用bin/hadoop fs -ls /就有用 应该使用绝对路径就不会有问题.... ...
- hadoop中 bin/hadoop fs -ls ls: `.': No such file or directory问题
2.x版本上的使用bin/hadoop fs -ls /就有用 应该使用绝对路径就不会有问题 mkdir也是一样的 原因:-ls默认目录是在hdfs文件系统的/user/用户名(用户名就命令行@符号 ...
随机推荐
- 【JSP EL】EL表达式里日期按照格式显示
转:http://blog.csdn.net/kaishuaige/article/details/8505174 JSP页面用EL表达式 输出date格式 1.头上引入标签 <%@ t ...
- lua string介绍
1. string库中所有的字符索引从前往后是1,2,...;从后往前是-1,-2,...2. string库中所有的function都不会直接操作字符串,而是返回一个结果 string.byte(s ...
- SharePoint 2013 代码创建应用程序目录(App Catalog)
众所周知,SharePoint App是2013版本的一大特色,那么,关于App的分发有几种方式呢?SharePoint给我们提供了两种方式,一种是上载到SharePoint应用商店,另一种是在本地S ...
- 解决用户自生成meta导入kylin后报错问题Can not deserialize instance of java.lang.String[] out of VALUE_STRING token
报错栈: -- ::, ERROR [http-bio--exec-] cube.CubeManager: : Error during load cube instance, skipping : ...
- Redis主从集群以及Sentinel的配置
安装完redis后,修改几个redis从节点的配置文件redis.conf,主要是加入主节点位置 slaveof 另外需要修改的地方包括,这样允许其他的从节点连入 bind 0.0.0.0 prote ...
- 彻底删除SVN版本库中部分文件或文件夹
例:假设SVN库路径为E:/svn/project,库中的目录结构为 QA/Trunk Software/Tags/test.exe 删除Software/Tags/目录下的test.exe文件 操作 ...
- @ERR Unsupported CONFIG parameter: notify-keyspace-events
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR Unsupported CONFIG parameter: noti ...
- SPSS Clementine 数据挖掘入门3
转摘:http://www.cnblogs.com/dekevin/archive/2012/04/27/2473683.html 了解SPSS Clementine的基本应用后,再对比微软的SSAS ...
- OpenMP 线程同步之临界区
多核/多线程编程中肯定会用到同步互斥操作.除了互斥变量以为,就是临界区. 临界区是指在用一时刻只允许一个线程执行的一段用{...},包围的代码段. 在OpenMP中临界区声明方法如下: #pragma ...
- webuploader解决不能重复上传问题及一些常见问题处理
uploader = WebUploader.create({ swf: 'resources/js/webuploader-0.1.5/Uploader.swf', // 文件接收服务端. serv ...