gzip #
You can compress files using the gzip command. The gzip command uses the LZ77 compression protocol.
The most basic command structure is the following:
gzip examplefile
This will compress the file and add a .gz extension to it.
The original file will be deleted.
To prevent the original file from being deleted you can use the following command structure:
gzip -c examplefile > examplefile.gz
This will leave the original file intact and write the output to examplefile.gz
You can compress multiple files by listing them:
gzip examplefile examplefile2
You can compress all files in a directory using the following command:
gzip -r examplefolder
You can also decompress files using the -d flag:
gzip -d examplefile.gz