Unzipping a gzip File with gunzip


Unzipping a gzip File with gunzip

To access gzipped files, you'll need to unzip them. You do so using gunzip, as Code Listing 13.11 shows.

To Unzip a gzip File with gunzip:

1.

ls -l *.gz

At the shell prompt, verify the name of the gzipped file with ls *.gz (Code Listing 13.11).

2.

gunzip zipadeedoodah.gz

Enter gunzip and the name of the file to unzip. gunzip will uncompress the file(s) and return you to the shell prompt.

Tips

  • When you're unzipping files with gunzip, you're not required to enter the file extension. gunzip zipadeedoodah would work just as well as gunzip zipadeedoodah.gz.

  • You might encounter gzipped files with a .tgz (tarred, gzipped), tar.gz, or just .gz extension. It'll handle any of those gracefully.

  • Some systems don't recognize the gunzip command, so you might need to use gzip -d to uncompress the files.

  • If you have a compressed file that you know is textold funnysayings from the net.gz, for exampleyou can uncompress it (without deleting the original file) and view it with a single command: gzcatoldfunnysayingsfromthenet | more.

  • gunzip understands how to uncompress most (compressed) files, including those compressed with compress or .zip files from DOS/Windows systems.


Code Listing 13.11. Use gunzip to uncompress zipped files.

[ejr@hobbes compression]$ ls -l *.gz -rw-rw-r-     1 ejr   users    53678 Jul 23 06:42 bigfile.gz -rw-rw-r-     1 ejr   users    53678 Jul 23 10:16 bigfile.new.gz -rw-r-r-      1 ejr   users    239819 Jul 27 10:22 zipadeedoodah.tar.gz [ejr@hobbes compression]$ gunzip zipadeedoodah.tar [ejr@hobbes compression]$ ls -l z* -rw-r-r-      1 ejr   users    501760 Jul 27 10:22 zipadeedoodah.tar [ejr@hobbes compression]$ ls -l *.gz -rw-rw-r-     1 ejr   users    53678 Jul 23 06:42 bigfile.gz -rw-rw-r-     1 ejr   users    53678 Jul 23 10:16 bigfile.new.gz [ejr@hobbes compression]$ 




Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net