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/用户名(用户名就命令行@符号 ...
随机推荐
- 如何使用V7包中ActionBar(Eclipse版)
转自:http://blog.csdn.net/appte/article/details/11712591 以前3.0以前的版本要使用ActionBar,必须使用国外大牛写的ActionBarShe ...
- Java垃圾回收精粹 — Part1
Java垃圾回收精粹分4个部分,本篇是第1部分.在第1部分里介绍了权衡点.对象生命周期以及全局暂停事件. 串行.并行.并发.CMS.G1.年轻代(Young Gen).新生代(New Gen).旧生代 ...
- 深入理解Apache Flink核心技术
深入理解Apache Flink核心技术 2016年02月18日 17:04:03 阅读数:1936 标签: Apache-Flink数据流程序员JVM 版权声明:本文为博主原创文章,未经博主允许 ...
- 在Qt示例项目的C ++ / QML源中的//! [0]的含义是什么?
在Qt示例项目的C ++ / QML源中的//! [0]的含义是什么? 例如: //! [0] GLWidget :: GLWidget(Helper * helper,QWidget * pare ...
- [Todo] solr, lucence等学习
先参考这个吧 http://www.shareditor.com/blogshow/6
- Android -- 压缩与解压文件
我在做一个项目中,工程文件中有一个功能需要很多图片,图片与app一起打包下来的话有30+M,那么我们就考虑另外下载压缩包,我们将图片取出,工程就只有4+M了,哈哈哈哈,呵呵,真恐怖.那么这样就涉及到另 ...
- zedboard--嵌入式网络摄像机(mjpg-streamer)的移植和搭建(二十二)
在zedboard上移植和搭建嵌入式网络摄像机mjpg-streamer.具体步骤如下: 来自:http://write.blog.csdn.net/postedit/13741451 1.安装lib ...
- 一致性哈希算法(Consistent Hashing) .
应用场景 这里我先描述一个极其简单的业务场景:用4台Cache服务器缓存所有Object. 那么我将如何把一个Object映射至对应的Cache服务器呢?最简单的方法设置缓存规则:object.has ...
- C#基础视频教程4.1 如何编写简单的计算器
要学会基本的窗体控件(button,textbox,label这种,以及他们的重要属性),每个控件的命名要符合规范(例如一般文本框都会重命名txtXXXXX,按钮都会重命名btnXXXXX) 为了 ...
- T-SQL 之 触发器
触发器可以做很多事情,但也会带来很多问题.正确的使用在于在适当的时候使用,而不要在不适当的时候使用它们. 触发器的一些常见用途如下: [1] 弹性参照完整性:实现很多DRI不能实现的操作(例如,跨数据 ...