Linux gzip compression and decompression shell command example

Here is sample shell code for compression and decompression using gzip:

Compressed file (compressed with gzip to a .gz file):

gzip file.txt

Unzip the file (unzip the .gz file):

gzip -d file.txt.gz

Compressed folder (compressed with tar and gzip to a .tar.gz file):

tar -czf folder.tar.gz folder/

Extract the folder (extract the .tar.gz file):

tar -xzf folder.tar.gz

Note that file.txtand in the above examples folderare the names of sample files and folders, you need to replace them according to your actual situation. Also, these commands are available on most Linux and macOS systems, but may require additional tools or software to perform the appropriate actions on Windows systems.

Guess you like

Origin blog.csdn.net/a772304419/article/details/132233561