Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Gzip on Linux  RSS feed

 
Parag Mokal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,
I've Red Hat Linix installed on my machine. I've problem with the Gzip utility. Any gzip file does not get unzippped on Linux, but the same file gets unzipped poperly on winzip.
Can anyone help me with this?
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you saying that when you unzip a gzipped file under linux it doesn't unzip? Are you explicitly telling it to unzip or expecting it to 'automatically' unzip? If the latter you need to explicitly unzip the file. For example, if your gzipped file is foobar.tar.gz you would type:
gzip -d foobar.tar.gz
-or-
gunzip foobar.tar.gz
and the resultant file should be foobar.tar
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look again. GZIP will take a file like "myfile" and REPLACE it with "myfile.gz". Also, GZIP is *NOT* ZIP! A zipfile is an archive containing one or more files - a GZIP file is just a comppressed file. To get the same effect as ZIP, you need something like the "TAR" utility as well:
tar cvf myfile.tar file1 file2 dir1/file3 ...
gzip myfile.tar
This will result in a "myfile.tar.gz".
Tar/gzip is so common that TAR even has an option builtin under Linux:
tar cvzf myfile.tgz file1 file2 dir1/file3 ...
GZIP make assumptions about the extension, BTW, TAR doesn't - the "tgz" is just a convenience and has no more meaning to TAR than "tar.gz" or even "foo.bar".
If you want to use gzip standalone, read the MAN page for other important things to know.
If you're doing a lot of Linux-to-Windows stuff. BTW, there's also GNU ZIP for Linux and Windows 32 and OS/2 and Macintosh and Amiga and ...
The main difference between tar and zip is that tar is more senstive to unix directory issues. Plus, WinZIP treats the untar-ungzip stages as discrete tasks, which is useful for some but confusing for many.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!