Questions tagged [compression]

Shrinking (compressing) and restoring (decompressing) of data.

Questions related to technology which shrinks (compresses) and restores (decompresses) data using a mathematical algorithm.

442 questions
1001
votes
17 answers

How can I reduce a video's size with ffmpeg?

How can I use ffmpeg to reduce the size of a video by lowering the quality (as minimally as possible, naturally, because I need it to run on a mobile device that doesn't have much available space)? I forgot to mention that when the video can use…
xralf
  • 14,393
  • 32
  • 119
  • 165
217
votes
14 answers

How to uncompress zlib data in UNIX?

I have created zlib-compressed data in Python, like this: import zlib s = '...' z = zlib.compress(s) with open('/tmp/data', 'w') as f: f.write(z) (or one-liner in shell: echo -n '...' | python2 -c 'import sys,zlib;…
mykhal
  • 3,559
214
votes
6 answers

How do I grep recursively through .gz files?

I am using a script to regularly download my gmail messages that compresses the raw .eml into .gz files. The script creates a folder for each day, and then compresses every message into its own file. I would like a way to search through this archive…
Kendor
  • 2,241
176
votes
2 answers

Zip everything in current directory

I'd like to compress and package everything, including files and folders in current directory, into a single ZIP file on Ubuntu. What would be the most convenient command for this (and name of the tool needed to be installed if any)? Edit: What if I…
Terry Li
  • 2,005
171
votes
13 answers

How to XZ a directory with TAR using maximum compression?

So I need to compress a directory with max compression. How can I do it with xz ? I mean I will need tar too because I can't compress a directory with only xz . Is there a oneliner to produce e.g. foo.tar.xz ?
LanceBaynes
  • 41,885
  • 101
  • 260
  • 359
113
votes
6 answers

Clear unused space with zeros (ext3,ext4)

How to clear unused space with zeros on ext3 or ext4 partitions? I'm looking for something smarter than cat /dev/zero > /mnt/X/big_zero; sync; rm /mnt/X/big_zero Like FSArchiver is looking for "used space" and ignores unused, but the opposite.…
105
votes
8 answers

Why would I tar a single file?

At my company, we download a local development database snapshot as a db.dump.tar.gz file. The compression makes sense, but the tarball only contains a single file ( db.dump ). Is there any point to archiving a single file, or is .tar.gz just such a…
gardenhead
  • 2,057
97
votes
9 answers

Is there a tool that combines zcat and cat transparently?

When handling log files, some end up as gzipped files thanks to logrotate and others not. So when you try something like this: $ zcat * you end up with a command line like zcat xyz.log xyz.log.1 xyz.log.2.gz xyz.log.3.gz and then with: gzip:…
0xC0000022L
  • 17,069
97
votes
7 answers

Is it possible to mount a gzip compressed dd image on the fly?

I like to create an image backup the first time I'm backing up a system. After this first time I use rsync to do incremental backups. My usual image backup is as follows: Mount and zero out the empty space: dd if=/dev/zero of=temp.dd bs=1M rm…
g19fanatic
  • 1,075
94
votes
8 answers

Which file compression software for Linux offers the highest size reduction for source code?

I do a ton of file compression. Most of the stuff I am compressing is just code, so I need to use lossless compression. I wondered if there was anything that offers a better size reduction than 7zip. It doesn't matter how long it takes to compress…
Zach
  • 1,071
85
votes
3 answers

How can I view gzipped files in less without having to type zless?

I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
73
votes
5 answers

How do I reduce the size of a pdf file that contains images?

I have a pdf file that contains images and I want to reduce its size in order to upload it to a site with a size limit. So, how can I reduce the size of a pdf file from the command-line?
Pandya
  • 26,011
64
votes
3 answers

What does the `-C` flag exactly do in `scp`?

I always use either rsync or scp in order to copy files from/to a remote machine. Recently, I discovered in the manual of scp ( man scp ) the flag -C -C Compression enable. Passes the -C flag to ssh(1) to enable compression. Before I discovered this…
Remi.b
  • 1,233
55
votes
4 answers

Does tar actually compress files, or just group them together?

I usually assumed that tar was a compression utility, but I am unsure, does it actually compress files, or is it just like an ISO file, a file to hold files?
TheDoctor
  • 1,015
41
votes
7 answers

How to decompress jsonlz4 files (Firefox bookmark backups) using the command line?

There seems to be various JavaScript+browser specific ways of decompressing this, but isn't there some way to transform jsonlz4 files to something unlz4 will read?
l0b0
  • 53,976
1
2 3
…
29 30