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.

409 questions
825
votes
12 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
  • 16,149
  • 29
  • 101
  • 149
190
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,001
  • 2
  • 12
  • 5
188
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,061
  • 2
  • 18
  • 16
169
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
  • 1,935
  • 2
  • 17
  • 14
161
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
  • 39,295
  • 97
  • 250
  • 349
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
  • 1,997
  • 2
  • 12
  • 12
97
votes
6 answers

Clear unused space with zeros (ext3,ext4)

How to clear unused space with zeros ? (ext3,ext4) 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 opposite site. Purpose: I'd…
Grzegorz Wierzowiecki
  • 13,865
  • 23
  • 89
  • 137
95
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
  • 16,189
  • 24
  • 102
  • 168
92
votes
6 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,023
  • 1
  • 9
  • 14
83
votes
6 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
  • 961
  • 1
  • 7
  • 5
80
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?
Ryan C. Thompson
  • 5,398
  • 6
  • 29
  • 23
59
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…
Remi.b
  • 1,125
  • 2
  • 11
  • 18
53
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
  • 935
  • 3
  • 8
  • 9
52
votes
4 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
  • 23,898
  • 29
  • 92
  • 144
40
votes
1 answer

What happened to bzip1?

bzip2 had been a de facto standard for quite strong compression throughout many years already. I myself had typed the bzip2 command thousands of times so far, which makes me wonder - what happened to bzip, or bzip1? Google doesn't seem to tell me…
d33tah
  • 1,361
  • 14
  • 28
1
2 3
27 28