To compress a file using gzip, type the following command on the terminal:
gzip filename
If the file has space in its name, you need to put the filename inside quotes.
gzip "file name"
To decompress a gzipped file, type the following command on the terminal:
gzip -d filename.gz