Use the colored LS in your MacBook

Source: Internet
Author: User
Tags macbook

1, first, the MacBook installed in the LS and the GNU LS is not the same, so, to download the installation of the genuine LS

Brew Install coreutils    //GNU ls in the inside

2, because and the Mac LS has a conflict, so, coreutils commands are added ' G ', such as LS into GLS, in order to remove this restriction, the GNU command can be placed in the execution folder at the front of the path, so that the GNU command will be executed first, not the Mac.

In the/etc/profile file, add:

 in your/etc/profilepath="/usr/local/opt/coreutils/libexec/gnubin: $PATH"  MANPATH="/usr/local/opt/coreutils/libexec/gnuman: $MANPATH"

3, solve the problem of color, first say the principle: LS--color=auto will be based on the color file set to different types of files or folders display different files, Coreutils also has a special command for debugging color dircolors. Its usage: dircolors generates a file to set the variable ls_colors and then executes the generated file with eval, and LS will display the color of the file. Dircolors-p also displays a default color configuration scheme.

4. Take a look at the following GNU instructions:

10.4' Dircolors ': Color Setup for' ls '======================================' dircolors ' outputs a sequence of shell commands toSetUp the terminal forColor output from' ls ' (and ' dir ', etc.). Typical Usage:eval"$ (dircolors [OPTION] ... [FILE])"If FILE isspecified, ' dircolors ' reads it to determine which colorsto use forwhich file types and extensions. Otherwise, a precompileddatabase isused. For details on the format of these files, run ' dircolors--print-database '. To make ' dircolors read a '~/.dircolors ' Fileifit exists, you canput the following linesinchYour ' ~/. BASHRC ' (or adapt them to Yourfavorite shell): D=. Dircolors Test-R $d && eval"$ (dircolors $d)"The output isA shell command toSetThe ' ls_colors ' environmentvariable. You can specify the shell syntax the command line,or ' dircolors ' would guess it fromThe value of the ' SHELL ' environment,variable.  The program accepts the following options. Also See*Note commonoptions::. '--sb ' '--Bosh "--bourne-Shell ' Output Bourne shell commands. this isThedefault ifThe ' SHELL ' environment variable is SetAnd does not end with ' csh ' or ' tcsh '. '-C ' '--csh "--c-Shell ' Output C shell commands. this isThedefault if' SHELL ' ends with ' csh ' or ' tcsh '. '--pp "--print-database ' Print the (compiled-inch)defaultColor Configuration database. This output isitself a valid configuration file, and isfairly descriptive of the possibilities. An exit status of zero indicates success, and a nonzero valueindicates failure.

5, I use and Vim's theme has been Molocai.

Https://github.com/seebi/dircolors-solarized

6, after the download, the inside of the dircolors.256dark copied into the user directory. Dircolors.

7. Edit the. bash_profile file to add:

Eval ' discolors ~/. dircolors ' Alias ls='ls--color=auto'

8. Reload the configuration file.

source. bash_profile

Use the colored LS in your MacBook

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.