This command compresses the file archivefile1.txt and replaces it with the compressed version named "archivefile1.txt.gz".
If you want to keep the uncompressed version, you can use the -c option, which writes to standard out, and then re-direct (">") standard out to a file like this:
The ".gz" file extension is commonly used by the compression program gzip, which is the counter part of gunzip.
gzip -c archivefile1.txt > archivefile1.txt.gz
You can use the "-r" option to recursively compress all the files under the specified directory:
gzip -r documents_folder