White Hat Institute

Linux basics

Command-line interface (part 9)

Compressing and archiving files

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.

  • : The  program is utilized to compress one or multiple records. Whenever executed, it replaces the original file with a compressed one. The relating  program is used to re-establish compressed documents to their unique, uncompressed structure.  compresses the size of the given documents utilizing Lempel-Ziv coding. At whatever point conceivable, each document is supplanted by one with the expansion 

Linux basics 74

Linux basics 75
  • : These commands are used to view compressed text documents.

Linux basics 76

Linux basics 77
  • and : The  is very similar to the “gzip” program, but uses a different compression algorithm named  block sorting text compression algorithm, and  coding. Documents compressed with  will end with the  extension. To decompress the file, use the  command.

Linux basics 78

Linux basics 79
  • : These commands are very similar to  and is used to display compressed files with .

Linux basics 80

Linux basics 81
  • is a Unix command which represents  It is utilized to combine or store numerous documents into a single file.

We frequently observe filenames that end with the extension  or  which indicate a simple  archive and a  archive, respectively. A  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  utility:

 creates an archive document from a file(s) or directory(s),

 extracts an archive,

 appends documents to the end of an archive,

And  lists the contents of the archive file.

For a complete rundown of modes, please refer to the manual pages of 

Linux basics 82

Linux basics 83

Linux basics 84
  •  is a straightforward, cross-platform document compressing and archiving utility for Unix-like frameworks including Linux and Windows OS, in addition to numerous other operating systems. The  format is a standard archiving file format used on Windows PCs, and most importantly, it allows you to provide the compression level between 1 and 9 as an option. A separate companion program is  which unpacks and decompresses  archives.

Linux basics 85

Linux basics 86