It is essential to understand the distinction and connection between an archive document and a compressed document. An archive document is a gathering of files and directories that are put away in one document. The archive file does not compress — it utilizes a similar measure of disk space as all the individual documents and registries consolidated. A compressed document is an accumulation of files and directories stored in a way that uses less space on the disk than all the records and indexes combined.
On the off chance that you need more disk space on your PC, you can compress documents that you don’t utilize all the time or records that you need to save yet don’t use any longer. You can even make an archive document and after that compress, it to save disk space. Please note that compressing already compressed data adds extra overhead, hence you will get a slightly bigger file. So it is a good practice not to compress a compressed file. There are numerous programs to archive, compress, and decompress documents in GNU/Linux. In this instructional exercise, you will become familiar with a couple of them.
Ex: ([email protected]:~/Downloads$ gzip file1)
Ex: ([email protected]:~/Downloads$ gunzip file1.gz)
Ex: ([email protected]:~/Downloads$ zcat HelloWorld.gz)
Ex: ([email protected]:~/Downloads$ zmore HelloWorld.gz)
Ex: ([email protected]:~/Downloads$ bzip2 HelloWorld)
Ex: ([email protected]:~/Downloads$ bunzip2 HelloWorld.bz2)
Ex: ([email protected]:~/Downloads$ bzcat HelloWorld.bz2)
Ex: ([email protected]:~/Downloads$ bzmore HelloWorld.bz2)
We frequently observe filenames that end with the extension “.tar” or “.tgz,” which indicate a simple “tar” archive and a “gzip” archive, respectively. A “tar” archive consists of a group of separate files, one or more directory hierarchies, or a mixture of both.
There are four main working modes in the “tar” utility:
“c” creates an archive document from a file(s) or directory(s),
“x” extracts an archive,
“r” appends documents to the end of an archive,
And “t” lists the contents of the archive file.
For a complete rundown of modes, please refer to the manual pages of “tar.”
Ex: ([email protected]:~/Downloads$ tar -cf tarfile.tar file1 InfoSec/ Security/)
Ex: ([email protected]:~/Downloads$ tar -tf tarfile.tar)
Ex: ([email protected]:~/Downloads$ tar -xf tarfile.tar)
Ex: ([email protected]:~/Downloads$ zip -r zipfile.zip file1 InfoSec/ Security/)
Ex: ([email protected]:~/Downloads$ unzip zipfile.zip)