The most common compressed archive file format in Linux is the tar.gz format. Tar file is an archive file format. Tar.gz is a compressed tar file.
Create tar.gz archives
The tar command can be used to create tar.gz archives.
tar czf new-tar-file-name.tar.gz file-or-folder-to-archive
Here is the command explanation:
c - create new archive. z - compress the archive using gzip. f - use archive file. new-tar-file-name.tar.gz - the name of the tar.gz to create. file-or-folder-to-archive - the name of the folder we want to archive.
Adding multiple directories
tar -czf new-tar-file-name.tar.gz file1 file2 folder1 folder2
Extract tar archives
gz archives
tar -xzf tar-file-name.tar.gz
Here is the command explanation:
x - extract the archive. z - uncompress the archive using gzip. f - use archive file. tar-file-name.tar.gz - the name of the tar.gz to create.
The tar command will extract all the files/folders in the archive to the current directory. To extract to specific location modify the command as follows
tar -xzf tar-file-name.tar.gz /path/to/location
bz2 archives
Extracting tar.bz2 (bzip2 file) is very similar to the way you extract tar.gz file. Instead of using the -z flag you need to use the -j flag for the bzip2 format
tar -xvjf tar-file-name.tar.gz
Here is the command explanation:
x - extract the archive. v - verbose. show information as files are being extracted. j - filter the archive through bzip2 f - use archive file. tar-file-name.tar.gz - the name of the tar.gz to create.
The tar command will extract all the files/folders in the archive to the current directory.
I think you will also find this useful: https://freetools.site/file-compressor/tar-gz
https://www.youtube.com/watch?v=D8dELyQ6kAY
visit this link to know the esiest method for extracting any type of file in kali linux