Both Linux and Unix like oses comes with z commands. It allows you to read gzip compressed text files using zless, zcat and zmore etc. gzip reduces the size of the files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times. zcommand has some cool usage - such as display the current time in different zonename.
The old way...
Let us say you have a file called data..txt.gz. To display file you can type:
gzip -d data.txt.gz
The new way...
Just use zless command:
Concatenate compressed files and print on the screen:
zdiff / zcmp command
Compare compressed files:
zdiff file1.gz file2.gz
zcmp file1.gz file2.gz
zegrep / zfgrep / zgrep command
Search compressed files for a regular expression:
zegrep -w '^word1|word2' file.gz
zgrep 'word' file.gz
zless / zmore commands
zmore and zless is a filter which allows examination of compressed or plain text files one screenful at a time on a screen. zmore works on files compressed with compress, pack or gzip, and also on uncompressed files. If a file does not exist, zmore looks for a file of the same name with the addition of a .gz, .z or .Z suffix.
Znew recompresses files from .Z (compress) format to .gz (gzip) format. If you want to recompress a file already in gzip format, rename the file to force a .Z extension then apply znew.
zdump command prints the current time in each zonename named on the command line. Let us say your current time zone is IST (Indian standard time) and like to see time current time for Los Angeles (USA - PDT), enter:
Fri Aug 31 20:51:39 IST 2007
Now display Los Angeles current time :
/usr/share/zoneinfo/America/Los_Angeles Fri Aug 31 08:20:31 2007 PDT
Search files in a ZIP archive for lines matching a pattern:
zipgrep *.cpp basesys.zip
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop