GW HELP DESK > UNIX
Search Advanced Search
Search Tips

Using gzip/gunzip to Compress/Uncompress Files
Posted: 10:37 AM, Monday, Feb 10, 2003
Last Updated: 7:00 PM, Tuesday, June 30, 2009

gzip is a UNIX program for compressing files. Developed under the GNU public license, gzip can usually at least halve the space that a file takes up. Furthermore, its compression method is well supported by other utilities on other computing platforms (such as WINZIP and Stuffit Expander), enabling you to decompress and work with your files on other computers

It is important to note that when you compress files, the originals are not deleted. You will have to delete them manually using the rm command.

RELATED LINKS

BEFORE YOU BEGIN

You must...
  • ...GW Faculty, Staff, or Student and have an account on a UNIX server, such as Acad or Research2. If you have not already done so, please visit the Account Center for instructions on creating an Acad account.
  • ...connected to this UNIX server by SSH. Please see shell.html for details.
  • ...have a basic working knowledge of UNIX.

Using GZIP (compress) and GUNZIP (expand)

Text files, such as computer code, compress very well. On the other hand, binary files can be compressed, but not at the efficieny of plain text files. Images files, JPEGs, for example, are already compress and gzip may not compress them much further.

GZIP To Compress Files:

The syntax for Gzip is

gzip filename

The resulting file will be filename.gz - notice the .gz file extension. If you were compressing a tar file for example, the resulting file would be filename.tar.gz, and so on.

To achieve better compression, you can use the -9 option. (i.e. gzip -9 filename) This will take a little longer, but will result in your compressed file taking up less space.

GUNZIP To Expand Files:

To uncompress a file, the sister to Gzip is Gunzip. To uncompress a file, simply type

gunzip filename

Just like any UNIX program, full usage instructions for Gzip can be found using the man tool. Simply type man gzipat the prompt for full instructions.


Rate This Document
Help us improve by rating the quality of this document:
lowhigh

1

2

3

4

5
Liked or disliked this document? If you tell us why, we'll keep up the good work or improve it! Your submissions are anonymous.


If you would like a response, please send an email to the ISS Suggestion Box at suggest@gwu.edu.

Support & Contact Info:
Help Desk: (202) 994-5530
EAS Help Desk: (202) 994-5530, option 4
System Status: (202) 994-5530, option 3
Support: ITHelp Request
Suggestions: suggest@gwu.edu

The George Washington University
Help Desk Hours:
Monday-Friday: 7:00AM - 10:00PM
44983 Knoll Square, Bldg II, Suite 351
Ashburn, VA 20147
ITS Fax: (202) 994-0101
Help Desk Fax: (703) 726-4111