osx - how to view different file extension in different color ib terminal of mac leopard -
I'm trying to get a colored list of directories and colors according to their extension after the ls command. Recently I replaced Mac Leopard with Linux. There is no .bashrc file in my home directory, so I have made one of the following content. It's doing just a bit that I want (colorful directories only). I also want to see files with different extensions in different colors. What else to add? Already thanx :)
# Definitions of how the Bash prompt looks like: # # user @ host - working Dior #export PS1 = '\ u @ \ h \ w $ 'Export PS1 =' \ u @ \ h \ w: '# Clay Colors Export Clickolor = 1 # Use Blue for export of Dior LSCLORS = XFCCDDDBXAgabackCaked # Alias # # LIS LS =' LS-L '
comes with OS X LS
BSD Is, and the lack of some features of the GNU brother.
To get the results you want, you need to install coreutils
(assuming that you have installed MacPortes, then sudo port install coreutils
play), which will give you GNU version, although prefixed by a g
(i.e. gls
).
Next, Command gdircolors -p> ~ / .dir_colors
to create the file where you will store your color preferences. There are already many common file extensions in it, just add it to any missing people or if you prefer different colors, then change the number or copy existing one if you already have a GNU / Linux installation
To make your colors work, first open .bash_profile
and add lines:
< Code> Eval `gdircolors ~ / .dir_colors` alias ls =" gls --color = auto "alias ll =" gls --color = auto -lh "alias la =" gls --color = auto -a "
which will override BSD versions and add color. Then either turn on the source .bash_profile
or open a new terminal to make changes effective. If you get the error bash: dircolors: command not found
, you can not find gdircolors
in your code, so make sure it appears
export pat = / opt / local / bin: / opt / local / sbin: $ PAT In the end, I have read in such places That may be a better place in your .bashrc
file, which adds to that position. Add that line to the lines and at the end of your .bash_profile
: if [-f / / obscure]; Again . ~ / .bashrc;
If it is necessary or not, then I have no problem with it.
Comments
Post a Comment