Linux Fundamentals zipping, unzipping, and decompression
The zip command is a Linux command-line tool that lets us create an archive of files and directories.
Unzip command is used to extract zip files. compression compresses a file while it is still open, replacing the original with a compressed version.
decompression is after compression, restoring files to their original state
zip and unzip commands:
mkdir temp1
cd temp1
touch test.txt
zip test.zip temp1/ (Here I used zip command to zip temp1 as test.zip)
unzip test.zip (Here I used unzip command to unzip test.zip)
compressing and decompressing:
tar -cvf test.tar temp1/ (c — create,v — verbose,f-archive) it is used to compress temp1 as test.tar
tar -xvf test.tar (x-extract) it is used to decompress test.tar
tar -cvzf test.tar.gz temp/ (compressing as gz)
gunzip test.tar.gz (extracting gz to tar)
tar -xvf test.tar
tar -xvzf test.tar.gz (it’s directly extract gz to directory)
tar -cvjf test.tar.bz2 temp1/ (bzip2 compression command)
tar -xvjf test.tar.bz2