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/用户名(用户名就命令行@符号 ...
随机推荐
- Singleton 单例模式(懒汉方式和饿汉方式)
单例模式的概念: 单例模式的意思就是只有一个实例.单例模式确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例.这个类称为单例类. 关键点: 1)一个类只有一个实例 这是最基本 ...
- RxJava 和 RxAndroid (生命周期控制和内存优化)
RxJava使我们很方便的使用链式编程,代码看起来既简洁又优雅.但是RxJava使用起来也是有副作用的,使用越来越多的订阅,内存开销也会变得很大,稍不留神就会出现内存溢出的情况,这篇文章就是介绍Rxj ...
- PIR人体检查
1.无变化时电压为0.8V左右 2.当检查到人体活动,电压保持为-1.3V,直到运动停止. 下面是示波器的截图
- iOS: 删除真机测试的Provisioning Profile后,在Code Singing中出现entitlements.plist文件无效,解决办法如下:
问题主题:method to The entitlements specified in your application’s Code Signing Entitlements file do no ...
- Python 字符串前面加'r'
在Python的string前面加上‘r’, 是为了告诉编译器这个string是个raw string,不要转意backslash '\' . 例如,\n 在raw string中,是两个字符,\和n ...
- _vsnprintf在可变参数打印中的用法
_vsnprintf,C语言库函数之一,属于可变参数.用于向字符串中打印数据.数据格式用户自定义. 函数简介 编辑 头文件: #include <stdarg.h> 函数声明: int _ ...
- CC+语言 struct 深层探索——CC + language struct deep exploration
1 struct 的巨大作用 面对一个人的大型C/C++程序时,只看其对struct 的使用情况我们就可以对其编写者的编程经验进行评估.因为一个大型的C/C++程序,势必要涉及一些(甚至 ...
- Python爬虫(3)豆瓣登录
前面(1)(2)的内容已经足够爬虫如链家网之类的不需要登录可以直接获取数据的网站. 而要爬取社交网站比较鲜明的特点就是需要登录,否则很多东西都无法获取.经过测试发现,微博,知乎都不是很好登录,知乎有时 ...
- 用curl抓取网站数据,仿造IP、防屏蔽终极强悍解决方式
最近在做一些抓取其它网站数据的工作,当然别人不会乖乖免费给你抓数据的,有各种防抓取的方法.不过道高一尺,魔高一丈,通过研究都是有漏洞可以钻的.下面的例子都是用PHP写的,不会用PHP来curl的孩纸先 ...
- log4j.properties 详解与配置步骤总结
先提供一个项目中使用log4j.properties配置 #log4j.rootLogger=WARN, stdout, file log4j.rootLogger=INFO,console,dail ...