Usage And Variation

  1. gzip by itself will compress a file
  2. gzip -d will decompress a file
  3. gzip -f forces a file to compress
  4. gzip -r directory-name compresses an entire folder
  5. gzip -k file-name compresses a file and keeps a copy of the uncompressed file

What is the GZIP command?

Similar to tar, gzip is a file compression tool used to decrease the file size of a single file or folder so that it can be transferred more easily. The gzip command allows you to both compress and decompress files.



In the image above, the user first issues an ls command to view the files in the directory, where we see a file named copyfile. The user then issues the command: gzip copyfile to compress the file. The ls command is entered again and we see that copyfile has now been compressed to copyfile.gz. The user then issues: gzip -d copyfile.gz to decompress the file. After another ls command, copyfile.gz is once again just copyfile.

Try it: