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 *.gz

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

2.
gunzip zipadeedoodah.tar

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

Tip

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 zipadeedoo dah.tar.


Tip

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


Tip

If you have a compressed file that you know is text— oldfunnysayingsfromthenet.gz, for example—you can uncompress it (without deleting the original file) and view it with a single command: zcat oldfunnysayingsfromthenet | more.


Tip

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]$

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.235.79