A Perl program that can color the output of tar tvf similarly to the way GNU ls would.
By Marc Abramowitz (http://marc-abramowitz.com)
From the CPAN distribution:
$ cpanm App::TarColor
Download a tarball App-TarColor-<version>.tar.gz from the downloads page.
Or build a tarball from the repository using Dist::Zilla:
$ dzil build
Install from the tarball with cpanm (a.k.a.: App::cpanminus):
$ cpanm App-TarColor-<version>.tar.gz
Or untar the tarball and build it:
$ tar xzf App-TarColor-<version>.tar.gz
$ cd App-TarColor-<version>
$ perl Makefile.PL
$ make && make test
Then install it:
$ make install
If you are installing into a system-wide directory, you may need to run:
$ sudo make install
You can use tarcolor manually like this:
$ tar tvf some_tarball.tgz | tarcolor
There is also a bundled shell script (for bash and zsh) that makes tar
automatically pipe its output through tarcolor:
$ source /usr/local/etc/tarcolor/tarcolorauto.sh
$ tarcolorauto on
$ tar tvf some_tarball.tgz
... colored output ...
$ tarcolorauto off
$ tar tvf some_tarball.tgz
... normal uncolored output ...
Colors can be customized using the LS_COLORS or TAR_COLORS environment variables:
$ export TAR_COLORS='di=01;34:ln=01;36:ex=01;32:so=01;40:pi=01;40:bd=40;33:cd=40;33:su=0;41:sg=0;46'
The format for LS_COLORS and TAR_COLORS is the same format used by LS_COLORS (used by GNU ls). So if you use GNU ls and have your LS_COLORS set, then tarcolor will use similar colors as ls.
-
Mac OS X 10.6.8 (Snow Leopard)
- bsdtar 2.6.2 -- libarchive 2.6.2
- GNU tar 1.17 in
/usr/bin/gnutar - GNU tar 1.26 installed with Homebrew
- pax --
/bin/pax -v -f - bsdcpio 1.1.0 -- libarchive 2.6.2 --
cpio -itv < file.tar
-
Mac OS X 10.7 (Lion)
- bsdtar 2.8.3 -- libarchive 2.8.3
-
OpenIndiana b151A
-
CentOS 5.5/Linux 2.6.16.33
-
Fedora 16
- GNU tar 1.26
-
Ubuntu 11.10
- GNU tar 1.25
- Debian dpkg 1.16.0.3 --
dpkg --contents file.deb
-
Debian 4.4.5-8/Linux version 3.1.9-vs2.3.2.5 (DreamHost VPS)
- GNU tar 1.16
- GNU cpio 2.6 --
cpio -itv < file.tar - Debian dpkg 1.13.26 --
dpkg --contents file.deb
-
FreeBSD 9.0
- bsdtar 2.8.4 -- libarchive 2.8.4
- GNU tar 1.26
- pax --
/bin/pax -v -f - bsdcpio 2.8.4 -- libarchive 2.8.4 --
cpio -itv < file.tar
-
Windows 7/Cygwin 1.7.11-1
- GNU tar 1.25
- bsdtar 2.8.3 -- libarchive 2.8.3
- GNU cpio 2.11 --
cpio -itv < file.tar - bsdcpio 2.8.3 -- libarchive 2.8.3 --
cpio -itv < file.tar - atool 0.38.0 --
atool -l file.tar
- Send me your ideas (especially with patches!)
