背景说明 打开Mac的Terminal终端执行ls和grep命令后的输出没有颜色区分,此时很难区分目录和文件(普通文件和可执行文件) 解决方案 通过vim命令编辑文件~/.bash_profile追加环境变量 # Tell ls to be colourful export CLICOLOR=1 export LSCOLORS=Exfxcxdxbxegedabagacad # Tell grep to highlight matches export GREP_OPTIONS='--color=auto' 通过命令生效source ~/.bash_profile再次执行ls即可看到出现了颜色