Compressing Files in Linux

by In Linux Find Truth
Compressing Files in Linux

There are a few compression algorithms that are used in Linux to compress files. One such command is the gzip command. However, this command in the Linux Terminal will compress only one file at a time and it does this process "in place"; that is to say, the original file is compressed and its filename is appended with the .gz extension while the original file no longer exists intact, but only in its replaced compressed format. Decompressing a .gz file is easy to do by simply running the gunzip command in the CLI against the .gz archive file.

Another compression command used in the CLI is zip. This is a universal compression algorithm across all *nix platforms. This particular compression command will allow the user to compress more than one file at a time and place that file in an archive file which can be named whatever the user wishes to name it so long as it is a unique name. The file extension that is suffixed on the archived file is .zip. Decompressing the file is as simple as running the unzip command against the archive.

Some additional commands associated with zip that can be useful for the Linux user are: zipdetails, used to obtain a large amount of detail about the zipped archive; zipinfo, which is used to obtain the size of the file, number of elements in the archive, and the average compression expressed as a percentage of the original filesize; cloakzip, used to encrypt the archive; zipnote, which is used at add comments to an archive file; and finally, zipsplit, used to split an archive into multiple archive files of roughly the same size.

Take a look at the video that follows for a more indepth look into each of these compression CLI commands in Linux.

February 28, 2019
by In Linux Find Truth
Blog