188

If you want to grep recursively in all .eml.gz files in the current directory, you can use: find . -name \*.eml.gz -print0 | xargs -0 zgrep "STRING" You have to escape the first * so that the shell does not interpret it. -print0 tells find to print a null character after each file it finds; xargs -0 reads from standard input and runs the command after it ...


165

Advantages of using .tar.gz instead of .gz are that tar stores more meta-data (UNIX permissions etc.) than gzip. the setup can more easily be expanded to store multiple files .tar.gz files are very common, only-gzipped files may puzzle some users. (cf. MelBurslans comment) The overhead of using tar is also very small. If not really needed, I still do not ...


150

You mentioned wanting to reduce filesize to fit more videos on a mobile device, which is my usecase as well. All the answers here are for reducing the compression quality but nobody has mentioned reducing video frame size. It's a lot quicker, up to multiple times faster depending on your source and the amount of the resolution decrease, as there are less ...


120

zlib-flate -uncompress < IN_FILE > OUT_FILE I tried this and it worked for me. zlib-flate can be found in package qpdf (in Debian Squeeze, Fedora 23, and brew on MacOS according to comments in other answers) (Thanks to user @tino who provided this as a comment below the OpenSSL answer. Made into propper answer for easy access.)


97

I tested most of the other proposed answers to this question. The test data conclusions are below. These are the proposed answers that I tested: (BR) Modify the bitrate, using: ffmpeg -i $infile -b $bitrate $newoutfile (CR) Vary the Constant Rate Factor, using: ffmpeg -i $infile -vcodec libx264 -crf 23 $outfile (SZ) Change the video screen-size (for ...


89

lrzip is what you're really looking for, especially if you're compressing source code! Quoting the README: This is a compression program optimised for large files. The larger the file and the more memory you have, the better the compression advantage this will provide, especially once the files are larger than 100MB. The advantage can be chosen to ...


84

There's a lot of confusion here because there isn't just one zgrep. I have two versions on my system, zgrep from gzip and zgrep from zutils. The former is just a wrapper script that calls gzip -cdfq. It doesn't support the -r, --recursive switch.1 The latter is a c++ program and it supports the -r, --recursive option. Running zgrep --version | head -n 1 will ...


72

Note that it seems that ffmpeg already performs some optimization when ran without options, so before trying to use settings you don't understand or deciding to explicitly lose information, give a try to a default conversion : ffmpeg -i input.mp4 output.mp4 In my case it reduced the bitrate of both the video and audio (you can check and compare the input ...


63

Tar is an archiving tool (Tape ARchive), it only collects files and their metadata together and produces one file. If you want to compress that file later you can use gzip/bzip2/xz. For convenience, tar provides arguments to compress the archive automatically for you. Checkout the tar man page for more details.


63

You are actually asking only half of the question. The other question being, "Why would I compress a tar file with gzip?". And the answer is not just that gzip makes the file smaller (in most cases): tar: stores filename and other metadata: mode, owner ID, group ID, filesize, modification time stores a checksum (for the header only) gzip: can store the ...


58

Unless you're looking for a specific bit rate, I'd recommend the -crf option. This is most commonly used for x264 encoding as described in this article. In short: a constant rate factor (CRF) of 23 would make a DVD quality movie (~700MB - 1GB) and lower CRF values would be higher quality (larger files). An example from the linked article: ffmpeg -i input.mp4 ...


53

I recommend pigz from Mark Adler, co-author of the zlib compression library. Execute pigz to see the available flags. You will notice: -z --zlib Compress to zlib (.zz) instead of gzip format. You can uncompress using the -d flag: -d --decompress --uncompress Decompress the compressed input. Assuming a file named 'test': pigz -z test - ...


47

You can use gs - GhostScript (PostScript and PDF language interpreter and previewer) as follows: Set pdfwrite as output device by -sDEVICE=pdfwrite Use the appropriate -dPDFSETTINGS. From Documentation: -dPDFSETTINGS=configuration Presets the "distiller parameters" to one of four predefined settings: /screen selects low-resolution output ...


45

You can do that using unzip -Zt zipname which prints a summary directly about the archive content, with total size. Here is an example on its output: unzip -Zt a.zip 1 file, 14956 bytes uncompressed, 3524 bytes compressed: 76.4% Then, using awk, you can extract the number of bytes: unzip -Zt a.zip | awk '{print $3}' 14956 Finally, put it in a for loop ...


42

mkimage -l uImage Will dump the information in the header. tail -c+65 < uImage > out Will get the content. tail -c+65 < uImage | gunzip > out will get it uncompressed if it was gzip-compressed. If that was an initramfs, you can do cpio -t < out or pax < out to list the content. If it's a ramdisk image, you can try and mount it with: ...


40

Summary of the methods (as mentioned in this question and elsewhere) to clear unused space on ext2/ext3/ext4: Zeroing unused space File system is not mounted If the "disk" your filesystem is on is thin provisioned (e.g. a modern SSD supporting TRIM, a VM file whose format supports sparseness etc.) and your kernel says the block device understands ...


37

I first want to clarify that, of the list you provided, tar is the only one that is not a compression algorithm. tar is short for Tape Archive, and is used to create archive files. In short, a single file that consists of one or more files. It is used to bundle files together so that they can be compressed by a compressor that is only able to compress a ...


36

The -C flag enables a gzip compression of an SSH stream. It's an equivalent of Accept-Encoding: gzip in HTTP. How the flag performs depends on a kind of data you transfer: When transferring a single large file, the performance would be near the same to zipping the file before the transfer (neglecting efficiency of zip vs. gzip algorithm). But using -C is ...


35

It's never really going to make any big difference, but zipping the file before copying it ought to be a little bit less efficient since using a container format such as zip that can encapsulate multiple files (like tar) is unnecessary and it is not possible to stream zip input and output (so you need a temporary file). Using gzip on the other hand, instead ...


33

It seems that the original bzip was pulled circa 1998 due to patent issues with the arithmetic compression used in. A bit of digging (really only reading Wikipedia) turns up an archived link to the bzip2 website from around this time. Here is the relevant section detail this and other differences: How does it relate to your previous offering (bzip-0.21) ?...


30

Try archivemount root@srv1:/backup# archivemount windows-2003-S.gz /target/ Unrecognized archive format root@srv1:/backup# archivemount -o formatraw windows-2003-S.gz /target/ Calculating uncompressed file size. Please wait. root@srv1:/backup# ls /target/ data root@srv1:/backup# file /target/data /target/data: DOS/MBR boot sector; partition 1 : ID=0x7, ...


30

There is a quite big advantage to using only-gzipped text files - the contents can be directly accessed with command-line tools like less, zgrep, zcat.


29

How is that? Shouldn't gzip manage to compress all those zeros? Yes, if they were zeroes. Unused disk space does not mean it contains zeros; it means it is unused, and may contain anything. There are programs that wipe unused disk space to zeroes. I suggest you use those before making the disk image. (I don't recall any offhand; in Linux, I'd just use dd ...


29

Citing the xz manpage (which you really should consult with such questions), in which I very quickly searched for sparse: --no-sparse Disable creation of sparse files. By default, if decompressing into a regular file, xz tries to make the file sparse if the decompressed data contains long sequences of binary zeros. It also works when writing to standard ...


28

I guess many people who come via Google to this question mean "archive and compress" when they write "zip". An alternative to the zip format is tar: tar -czf copy.tar.gz whatever/ where the compressed archive file will be copy.tar.gz and the contents will be everything in the folder whatever. -c, --create create a new archive -z, --gzip, --gunzip ...


27

Additional information provided in the comments reveals that the OP is using a GUI method to create the .tar.gz file. GUI software often includes a lot more bloat than the equivalent command line equivalent software, or performs additional unnecessary tasks for the sake of some "extra" feature such as a progress bar. It wouldn't surprise me if the GUI ...


25

xz -d < file.tar.xz | tar xvf - That's the same as with any compressed archive. You should never have to create an uncompressed copy of the original file. Some tar implementations like recent versions of GNU tar have builtin options to call xz by themselves. With GNU tar or bsdtar: tar Jxvf file.tar.xz Though, if you've got a version that has -J, ...


23

gzip or bzip2 will compress the file and remove the non-compressed one automatically (this is their default behaviour). However, keep in mind that while the compressing process, both files will exists. If you want to compress log files (ie: files containing text), you may prefer bzip2, since it has a better ratio for text files. bzip2 -9 myfile # ...


23

I was able to unpack the jsonlz4 by using lz4json: apt-get install liblz4-dev git clone https://github.com/andikleen/lz4json.git cd lz4json make ./lz4jsoncat ~/.mozilla/firefox/*/bookmarkbackups/*.jsonlz4


23

Save this script in a file, e.g., mozlz4: #!/usr/bin/env python from sys import stdin, stdout, argv, stderr import os try: import lz4.block as lz4 except ImportError: import lz4 stdin = os.fdopen(stdin.fileno(), 'rb') stdout = os.fdopen(stdout.fileno(), 'wb') if argv[1:] == ['-c']: stdout.write(b'mozLz40\0' + lz4.compress(stdin.read())) elif ...


Only top voted, non community-wiki answers of a minimum length are eligible