zsh: How to set LS_COLOR to show any tar file as different color than white?

I am using zsh

When I do ls: for any compressed file type such as .tar.gz, .tbz2, .zip I get them as white and not bold.On the other hand, in bash its color is red and in bold.

Is it possible to give different color than white to any compressed file type in zsh?


$ ls --version
ls (GNU coreutils) 8.30

I have following setup in me .zshrc file:

export CLICOLOR=1
export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:"
export LSCOLORS=ExGxBxDxCxEgEdxbxgxcxd
ls: aliased to ls -h --color=always -v --author --time-style=long-iso

When I remote connect to a machine default in zsh shell tar files’ color is white. Than I switch to bash and switch bach to zsh, then its color is changed back to red. Is it possible to have to behavior by default in zsh?

enter image description here

Asked By: alper

||

Based on your comment, your $LS_COLORS doesn’t include any compressed files, or any file extensions at all for that matter.

:ow=1;34:tw=1;34::ow=1;34:tw=1;34:

To start:

export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:*.tar=1;31:*.gz=1;31:*.tbz2=1;31"

In full for compressed files, you could add this:

*.tar=1;31:*.tgz=1;31:*.arj=1;31:*.taz=1;31:*.lzh=1;31:*.lzma=1;31:*.tlz=1;31:*.txz=1;31:*.zip=1;31:*.z=1;31:*.Z=1;31:*.dz=1;31:*.gz=1;31:*.lz=1;31:*.xz=1;31:*.bz2=1;31:*.bz=1;31:*.tbz=1;31:*.tbz2=1;31:*.tz=1;31:*.deb=1;31:*.rpm=1;31:*.jar=1;31:*.war=1;31:*.ear=1;31:*.sar=1;31:*.rar=1;31:*.ace=1;31:*.zoo=1;31:*.cpio=1;31:*.7z=1;31:*.rz=1;31

Answered By: wjandrea
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.