To access gzipped files, you’ll need to unzip them. You do so using gunzip, as Code Listing 13.11 shows.
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 text—old funnysayings from the net.gz, for example—you 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.
[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]$ |
3.17.68.14