原来是 ls -G
自带的命令就有这个功能。再做一个软链接就好了。和iterm2的配置无关似乎。
我下载之后发现和我打开系统默认的终端效果是一样的啊~应该怎么调整呢?
我是依照这个做的修改http://blog.csdn.net/sanwuhai/article/details/31357037
我搜了下,做了如下配置
1.修改了~/.bash_profile
插入了如下内容
export CLICOLOR=1
LSCOLORS=gxfxcxdxbxegedabagacad
exportPS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$'
exportTERM=xterm-color
2.然后把这个下载下来
https://github.com/baskerville/iTerm-2-Color-Themes/blob/master/arthur.itermcolors
导入了我的颜色配置,并选中了arthur
的配色
3.将Preferences->Profiles->Terminal->Terminal Emulation下的Report Terminal Type
设置为了xterm-256color
发现还是不是彩色的,怎么配置才对呢?
这是我的alias的一部分,让ls显示彩色的是其中的alias ls='ls --color=auto'
在起作用。
alias cls='tput reset'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
将其添加到bashrc中就行了
Mac OS X的ls命令和linux bash不一样,对应于linux上的alias ls='ls --color=auto'
,你应该写alias ls='ls -G'
见:http://superuser.com/questions/183876/how-do-i-get-ls-color-auto-to-work-on-mac-os-x
修改完.bash_profile需要source .bash_profile
推荐zsh + oh-my-zsh,我安装完没设置就是256 colors
正解如下
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagacad
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
export TERM=xterm-color
CLICOLOR=1 和 LSCOLORS=gxfxcxdxbxegedabagacad前面没有export
export PS1 不是 exportPS1
export TERM 不是 exportTERM
不知道是谁最先这么干的搞得基本全网答案都是错的 坑人啊
这个弄完了 文件夹是没有颜色的 你还要alias ls='ls --color=auto'
好像只这么写是不对的 你百度下吧 这个肯定是对的