1/5/2024 0 Comments Tar.gz decompressorPigz - Compress And Decompress Files In Parallel In Linux.To view the contents of a compressed file without decompressing it: $ bunzip2 -c 2įor more details, refer man pages. To decompress a compressed file: $ bzip2 -d 2 If you don't want to replace the original file, use -c flag and write the output to a new file. To compress a file using bzip2, replacing it with compressed version, run: $ bzip2 ostechnix.txt Just replace gzip in the above examples with bzip2, gunzip with bunzip2, zcat with bzcat and so on. Like I said, the usage of bzip2 is almost same as gzip. The files compressed using bzip2 will end with. The bzip2 is very similar to gzip program, but uses different compression algorithm named the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compress and decompress files using bzip2 program You can view the contents of both files (ostechnix1.txt and ostechnix2.txt) without extracting them using any one of the following commands: $ gunzip -c $ gunzip -c output.txt $ zcat $ zcat output.txtįor more details, refer the man pages. The above two commands will compress ostechnix1.txt and ostechnix2.txt and saves them in one file named. $ gzip -c ostechnix1.txt > $ gzip -c ostechnix2.txt > How? Have a look at the following example. It is also possible to concatenate multiple compressed files into one. To compress a file named ostechnix.txt, replacing it with a gzipped compressed version with best compression level, we use: $ gzip -9 ostechnix.txt 1.6 Concatenate multiple compressed files It supports 3 compression levels as given below. $ zless 1.5 Compress file with gzip by specifying compression levelĪnother notable advantage of gzip is it supports compression level. $ gunzip -c | less $ zcat | lessĪlternatively, there is a zless program which performs the same function as the pipeline above. You can also pipe the output to "less" command to view the output page by page like below. To view the contents of the compressed file using gzip without decompressing it, use -c flag as shown below: $ gunzip -c Īlternatively, use zcat utility like below. $ gunzip 1.4 View contents of compressed files without decompressing them We can also use gunzip to decompress the files. To decompress the file, replacing it with the original uncompressed version, we do: $ gzip -d In both cases, it won't delete the original file. The above command decompresses the file and writes the output to ostechnix1.txt file. Similarly, to decompress a gzipped file specifying the output filename: $ gzip -c -d > ostechnix1.txt For example, the following command, compresses ostechnix.txt and writes the output to. You can, however, keep the original file and write the output to standard output. 1.2 Compress files and write the output to different files (Don't replace the original file)īy default, gzip program will compress the given file, replacing it with a gzipped compressed version. The above command creates compressed version of the directory listing of Downloads folder. One fine example is we can create a compressed version of a specific command's output. The gzip command can also be used in other ways too. Gzip will replace the original file ostechnix.txt with a gzipped compressed version named. To compress a file named ostechnix.txt, replacing it with a gzipped compressed version, run: $ gzip ostechnix.txt The gzip is a utility to compress and decompress files using Lempel-Ziv coding (LZ77) algorithm. Compress and decompress files using Gzip program Compress and decompress files using bzip2 programĪs stated already, the most commonly used programs compress files in Linux and Unix-like systems are:įirst, we will see the usage of Gzip. 1.6 Concatenate multiple compressed files.1.5 Compress file with gzip by specifying compression level.1.4 View contents of compressed files without decompressing them.1.2 Compress files and write the output to different files (Don't replace the original file).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |