A data compression program. Originally a GNU utility it has been cloned by most Unix variants.

learn more… | top users | synonyms

28
votes
2answers
94k views

Can I zip an entire folder using gzip?

I'm trying to zip a folder in unix. Can that be done using the gzip command?
0
votes
0answers
19 views

how to write dd command to replace backup image of root partition?

I have installed rhel6.5 in my pc. After that I have changed some configurations in file system. now I have taken backup image of /dev/sda1 which is a root partition of 15gb in size using the command ...
2
votes
1answer
34 views

Payload size of a gzip archive

Is there any way to check the normal size of the compressed datasets (.gz) without decompressing it? For example, I have 50 large .gz files (in total 50 Gb) that can't be decompressed due to storage ...
3
votes
2answers
51 views

Less resource hungry alternative for piping `cat` into gzip for huge files

I have some files of which some are very large (like several GB), which I need to concatenate to one big file and then zip it, so something like this: cat file1 file2 file3 file4 | gzip > ...
4
votes
1answer
84 views

How come zipping a created disk image, makes smaller files than piping?

Case 1. I use dd to create an image: dd if=/dev/rdiskx of=/path/to/image bs=1m. It's 16 GB in size. I zip it, and it's suddenly around 100 MB. Case 2. I use dd to create an image, piping it ...
3
votes
1answer
58 views

Estimate the size of the extracted files before extraction a `tar.gz` archive?

Before using tar to extract a .tar.gz archive, it is possible to get an estimate of how large the extracted files are in total?
1
vote
1answer
57 views

Why I get unexpected end of file in my script when using gzip?

I have one doubt with this: for i in ./*.gz do gunzip -c $i | head -8000 | gzip > $(basename $i) done I get an "unexpected end of file" error for gzip, and I don't get the 8000 at all, only a ...
17
votes
6answers
2k views

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 ...
1
vote
2answers
117 views

command to get topmost directory name in compressed files

Filenames are ones shown below, but the directory will be libgit2-0.21-1 when tar xvf v0.21.1.tar.gz, so how use one-liner to get the directory name(report error if more than two directory exist): ...
2
votes
1answer
56 views

How to create a deterministic tar.gz using git-archive?

Creating a git repository for testing. ~ $ mkdir somefolder ~ $ cd somefolder/ ~/somefolder $ git init Initialized empty Git repository in /home/user/somefolder/.git/ ~/somefolder $ echo test > ...
9
votes
1answer
370 views

Use gzip to compress a directory except for already existing .gz files in the directory

I have a directory of logs that I would like to set up a job to compress using gzip. The issue is I don't want to recompress the logs I've already compressed. I tried using ls | grep -v gz | gzip, ...
3
votes
4answers
308 views

Does gzip add integrity/crc check to a .tar?

I run commands: tar -cf myArchive.tar myDirectory/ gzip myArchive.tar then I copy the file over a lot of unreliable mediums, and later I unpack it using: tar -xzf myArchive.tar.gz The fact that ...
0
votes
1answer
62 views

moving files to a folder and zip the folder

I have to zip a few files induvidually from folder A and move them to folder B on the same directory which takes lot of time. So I thought of moving all those files to be zipped to a new folder(c), ...
0
votes
2answers
149 views

touch & gzip all HTML, CSS, JS files in a directory recursively

I'm trying to optimize Nginx server. I've enabled Gzip_Static_Module to serve pre-compressed gzip static files like CSS, JS, HTML. Nginx Wiki says that the timestamps of the compressed and ...
0
votes
2answers
51 views

How to combine gunzipped fastq files?

How can I combine gzipped fastq files? I tried this for read 1 and read 2 zcat file_1.fastq.gz file_2.fastq.gz | gzip > combined.fastq.gz but it is giving me unequal number of reads. Why? Is ...
0
votes
2answers
43 views

Automatic extraction of zip files like in osx

In Mac OSX if you have downloaded a zip/gz/bz2 file, and you double click it in Finder, then the archive is automatically extracted for you in a subfolder, which I find very nice. I am wondering if ...
1
vote
2answers
159 views

I accidentally GZIPed a whole bunch of files, one by one, instead of using tar(1). How can I undo this mess?

I'm new to the gzip command, so I googled some commands to run so I can gzip an entire directory recursively. Now while it did that, it converted each of my files to the gzip format and added .gz to ...
1
vote
2answers
68 views

Unzipping a .gz file without removing the gzipped file

I have file.gz, when I try to unzip this file by using gunzip file.gz, it unzipped the file but only contains extracted and removes the file.gz file. How can I unzip by keeping both unzipped file and ...
3
votes
3answers
6k views

How to recover a corrupted “tar.gz” file

I suddenly needed to recover an old tar.gz file, but as soon as I execute so: tar -zxvf filename.tar.gz I get this: gzip: stdin: invalid compressed data--format violated tar: Child returned ...
2
votes
2answers
86 views

Estimate compressibility of file

Is there a quick and dirty way of estimating gzip-compressibility of a file without having to fully compress it with gzip? I could, in bash, do bc <<<"scale=2;$(gzip -c file | wc -c)/$(wc ...
7
votes
3answers
11k views

Is it possible to compress a very large file (~30 GB) using gzip?

Is it possible to compress a very large file (~30 GB) using gzip? If so, what commands, switches, and options should I use? Or is there another program (preferably one commonly available on Ubuntu ...
4
votes
2answers
204 views

can't decompress .tgz using gunzip

I was able to archive and compress a folder with the following command: tar -cvfz example2.tgz example1 I then removed the example1 folder and tried to unpack the archive using this command: tar ...
0
votes
0answers
750 views

cuda - gzip: stdin: invalid compressed data--format violated

I downloaded cuda toolkit from here! I'm running on 32-bit Linux(Mint 17). I had to download .run file(the downloaded file name is ...
0
votes
0answers
70 views

Terminal freezes after using tar or gz

On Linux within bash the Pseudo Terminal window (terminator) as well as the Terminal itself "freezes" when trying to use autocomplete (TAB) as well as after getting an error message using gzip and ...
3
votes
4answers
242 views

gunzip a folder with many files

I have a folder with 36,348 files gz files. I want to unzip all of them. Running: gunzip ./* results in -bash: /usr/bin/gunzip: Argument list too long Whats the easiest way to get around ...
5
votes
4answers
1k views

How to create a gzip file without .gz file extension?

I would like to create a gzipped file that retains the original file name. For example gzipping "example.txt" should output a gzipped file named "example.txt" rather than "example.txt.gz." Is it ...
0
votes
3answers
111 views

How do you view a sql.gz file as plain text SQL from the command line?

How do you view a sql.gz file as plain text SQL from the command line? I want to read the SQL statements stored in a .sql.gz file, from the command line on the server. I've tried tar -xzvf, but get ...
2
votes
3answers
637 views

How do I use gunzip and tar to extract my tar.gz file to the specific directory I want?

When I run gunzip -dc /path_to_tar.gz_file/zip1.tar.gz | tar xf - in the directory where the tar.gz file is located, it extracts just fine. How do I tell it to place the contents from the tar.gz file ...
73
votes
4answers
9k views

Why are tar archive formats switching to xz compression to replace bzip2 and what about gzip?

More and more tar archives use the xz format based on LZMA2 for compression instead of the traditional bzip2(bz2) compression. In fact kernel.org made a late "Good-bye bzip2" announcement, 27th Dec. ...
6
votes
6answers
13k views

How can i view the contents of a tar.gz file (filenames + filesize)

I cannot use tar -tz as the solaris version I'm using does not accept the -z option. I tried something like gunzip file.tar.gz | tar -tv but that only gives: tar: /dev/rmt/0: No such file or ...
3
votes
2answers
294 views

Gzip large amount of symlinked files

I have a folder containing a large amount of symlinked files. These files are each on the order of 10-11GB (fastq files to be specific). They come from a variety of source folders, but I made sure ...
4
votes
1answer
7k views

gunzip all .gz files in directory

I have a directory with plenty of .txt.gz files (where the names do not follow a specific pattern.) What is the simplest way to gunzip them? I want to preserve their original names, so that they go ...
0
votes
0answers
78 views

Unix gunzip decompression [closed]

So this is a very annoying problem, I have a file in the Linux terminal ERR091571_1.fastq.gz And I run gunzip on it to decompress the file... gunzip ERR091571_1.fastq.gz But all that happens is ...
15
votes
5answers
698 views

Is it possible to make zcat output text even if it's uncompressed? [duplicate]

The problem is I have some database dumps which are either compressed or in plain text. There is no difference in file extension etc. Using zcat on uncompressed files produces an error instead of the ...
20
votes
1answer
24k views

How do you extract a single folder from a large tar.gz archive?

I am using this command on a 5GB archive tar -zxvf archive.tar.gz /folder/in/archive is this the correct way to do this? It seems to be taking forever with no command line output...
0
votes
0answers
129 views

Extract specific folder from a tar.gz

I know this question was previously asked on this site before like here 1 and here 2 but no success for me. I want to extract the Measures folder from my S012011_csv.tar.gz zipped file. If I do tar ...
21
votes
3answers
46k views

Add/update a file to an existing tar.gz archive?

Is there a way to add/update a file in a tar.gz archive? Basically, I have an archive which contains a file at /data/data/com.myapp.backup/./files/settings.txt and I'd like to pull that file from the ...
0
votes
2answers
71 views

Unzipping appearing to fail

I run: ~$ gzip -d Mom.img.gz ^C ~$ I created Mom.img.gz by piping a dd to gzip. Should I be seeing output? I tried it with the GUI too, and the progress bar didn't move.
8
votes
4answers
13k views

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 ...
0
votes
2answers
150 views

OpenMeetings latest release not unzipping

I am trying to install OpenMeetings for centos 6.5 32 bit but everytime I try to untar or unzip the latest binary release I get the following error: tar -xzvf apache-openmeetings-3.0.0.tar.gz gzip: ...
3
votes
2answers
103 views

TAR: better to skip directory or use split

I've got a file.tar.gz that I create and backup to Amazon S3. It's gotten bigger than Amazon's limits and thus has not been backing up. This is my current command: tar -cpzf file.tar.gz directory/ ...
2
votes
2answers
176 views

How can I flatten nested .tar.gz files?

I've got a bunch of .tar.gz files in different paths. I'd like to create a new .tar.gz file at some common ancestor of them and I don't want it to be composed of nested .tar.gz files. How can I easily ...
1
vote
1answer
1k views

Error with a .gz file decompression in Mint, but works perfectly in Windows, so the file is not corrupt

I've downloaded some .csv files from the OECD Stats website, since I need them to plot some graphs with gnuplot. When I open them with File Roller 3.4.1 (the default program to handle archive files), ...
1
vote
2answers
262 views

Uncompress files when rsync'in

I have 22,000 gzip files on a remote server, which I would like to trasnfer to my machine. I would also like to uncompress these files before/while transferring. Is it possible? My rsync command ...
43
votes
3answers
32k views

How to tell gzip to keep original file?

I would like to compress a text file using gzip command line tool while keeping the original file. By default running the following command gzip file.txt results in modifying this file and renaming ...
1
vote
2answers
228 views

portable command to unzip and untar on non GNU and old unix

On AIX 6.1 without GNU Tool installed I have a .tar.gz file. On Ubuntu I would use the very useful command : tar xzf myfile.tar.gz but in this case the z switch is not possible. I do remeber a ...
-5
votes
2answers
3k views

ungzip the gizpped war

I am totally new to linux. I have gzipped a war file like this gzip mytest.war. I try to ungzip it like it --ungzip mytest.war.gz, it said command can't be found. How can I ungzip it? Moreover, how ...
5
votes
3answers
4k views

speed up gzip compression

Is it possible to speed up the gzip process? I'm using mysqldump "$database_name" | gzip > $BACKUP_DIR/$database_name.sql.gz to backup a database into a directory, $BACKUP_DIR. the manpage ...
12
votes
5answers
21k views

tar: Removing leading `/' from member names

root@server # tar fcz bkup.tar.gz /home/foo/ tar: Removing leading `/' from member names How can I solve this problem and keep the / on file names ?
3
votes
1answer
494 views

Speed up zgrep on a multi-core computer

I'm running zgrep on a computer with 16 CPUs, but it only takes one CPU to run the task. Can I speed it up, perhaps utilize all 16 cores? P.S The IO is just fine, I could just copy the gzipped file ...