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

learn more… | top users | synonyms

1
vote
1answer
18 views

What happens to my files if I scp-ed to non existing directory

Here's what I did: copied some files from server to my local computer scp root@remotemachine:/var/log/nginx/* /home/me/logs deleted the files on the server The next moment I realized, that I ...
2
votes
3answers
131 views

How to print the before lines of search keyword with out using grep in a gz file?

How to print the lines before a search keyword without using grep in a .gz file? ID:342N000390AAAAAAAA 07/14/15 10:26 (MV90 ) * Register Data Imported * Warning - No ...
1
vote
4answers
134 views

UNIX to print a content from a .gz file

I have a .gz file with contents like the following: ID:123455 23-07-2015 mvni warning: RTM post warning : no profile data Using the string no profile data, I want to print the ID. I tried with ...
0
votes
3answers
25 views

How to delete files from a directory based on the contents of a gzipped tar file?

Given that I: have a directory that contains over 1000 files have a gzip'ed tar file that contains a subset of those files (x.tgz) What is the single command line (if it is possible) that will ...
8
votes
3answers
342 views

Pack file with tar.gz from root directory

I try to pack a .csv file with tar.gz, while being in the root directory. The file myfile.csv is located at /mnt/sdb1/ So the full filename is /mnt/sdb1/myfile.csv I try to save the tar.gz under ...
3
votes
4answers
302 views

Is it possible to make a .tar.gz file directly from stdin? Or, I need to tar together already gzipped files

I'm going to tell you exactly what I need in order to clarify the cryptic question in the title. I'm currently making scheduled MySQL backups of all my databases with something like: mysqldump ... | ...
6
votes
3answers
391 views

Does gz compression ratio improve over time?

I have some process that creates a stream of millions of highly similar lines. I'm piping this to gz. Does the compression ratio improve over time in such a setup? I.e. is the compression ratio better ...
0
votes
1answer
52 views

Compress multiple files and keep their name?

I have hundreds of .csv files that I need to compress into one file each. It should look like this originalname.csv.gz
0
votes
0answers
40 views

I can fix/repair small damaged tar.gz files using fixgz but it doesn't work on bigger files

The title tells it. I have some damaged .tar.gz files, most of them are pretty small (smaller than 1-2gb) but 4 of them are bigger and fixgz cant fix them, when i run fixgz for those big files, it ...
2
votes
1answer
65 views

Why the existence of gunzip?

What are the reasons (historical, compatibility issues ..) for the existence of gunzip despite gzip offers the same (and extended) functionality? I checked /bin/gzip and /bin/gunzip and they are ...
0
votes
1answer
61 views

Extract files from a corrupted .gz file

I tried to compress a directory using tar -zcvf output.gz input_dir. I suppose I should have used a .tgz extension for compressing. How do I untar output.gz? I tried both tar zxvf output.gz, which ...
1
vote
1answer
40 views

gzip files with cat and from pipe gives different results

Why does this give such output (both commands are supposed to do the same thing) and how can one make them give identical output? diff <(cat some_file | gzip -c - | base64) <(gzip -c some_file ...
11
votes
1answer
331 views

Why does gzipping a file on stdin yield a smaller output than the same file given as an argument?

When I do: # gzip -c foo > foo1.gz # gzip < foo > foo2.gz Why does foo2.gz end up being smaller in size than foo1.gz?
0
votes
2answers
236 views

tgz file give invalid compressed data--format violated [closed]

I have download this file http://download.icu-project.org/files/icu4c/55.1/icu4c-55_1-HPUX11iv3-aCC.tgz https://ssl.icu-project.org/files/icu4c/55.1/icu4c-bin-55_1.md5 md5sum ok But on linux and ...
8
votes
3answers
905 views

How do I compress files in-place?

I have a machine with 90% hard-disk usage. I want to compress its 500+ log files into a smaller new file. However, the hard disk is too small to keep both the original files and the compressed ones. ...
1
vote
1answer
126 views

unpigz (and untar) to a specific directory

I know how to gunzip a file to a selected location. But when it comes to utilizing all CPU power, many consider pigz instead of gzip. So, the question is how do I unpigz (and untar) a *.tar.gz file ...
3
votes
1answer
56 views

use tar to extract and immediately compress files from tarball

I have a compressed tarball (eg foo.tar.gz) that I wish to extract all the files from, but the files within the tarball are not compressed. That is to say, the contents of foo.tar.gz are ...
0
votes
1answer
35 views

How do you combine -r and -c for gunzip?

I am trying to recursively gunzip files (-r) but don't have permission in their original location to store them. I know to change the location for a single file you do gunzip {file} -c > {new file ...
0
votes
2answers
62 views

Is it possible to list all files in a *.tar.gz file without scanning it's whole contents?

I know this way only: tar --full-time -tvf /path/to/file.tar.gz But it makes tar to scan all the archive and it is time consuming if it is a very big one. My question is maybe there is a way to ...
-1
votes
1answer
56 views

Erratic behavior with gzip on unix

I am compressing log files daily and very recently I have been seeing some crazy results on the file type of the file after compression. Normally you would expect file filename.gz returning gzip ...
4
votes
1answer
49 views

Recovering data written to file that moved

I have a Python daemon running on CentOS that opens a file at the beginning of a session, and keeps writing to it. A cronjob however, gzipped the file that was being written to, and so the file moved ...
1
vote
1answer
75 views

Bash: using both way redirections in a shell script

I'm writing a shell script to compress and backup certain files. This will compress and move large files with sizes up to 4 GB. I'm having trouble with this line: gzip < $filelocation > ...
1
vote
1answer
88 views

Combining, sorting and deleting duplicates in numerous gzip files

I am going to be combining 15 different gzip files. Ranging in size from 2 gigs to 15 gigs each so the files are relatively large. I have done research on the best way to do it but still have some ...
0
votes
1answer
96 views

What's the difference between gzip and compress?

What is the difference between gzip and compress? What are the advantages of using compress function. I could see a size difference in the compressed file, but apart from this what are the main ...
0
votes
1answer
200 views

zcat / gzip error while piping out

I am using zcat to output the contents of a rather large .gz compressed text file. I am piping the output to grep and searching for a specific string. Below is the command I am running. ...
1
vote
1answer
67 views

How to replace string of the file, which is present in tar file through UNIX

I have a tar archive xyz.tar containing lots of .sh files like: 123.sh 456.sh 789.sh Every .sh file has some string content, e.g. 123.sh contains welcome to Hollywood, 456.sh contains I love ...
0
votes
2answers
212 views

Gzip file but excluding some directories|files and also append current date

I'm looking for a way to create a .tar.gz file from a directory but I have some doubts. I'm know that the command for create the file is: tar -zcvf /path/to/compressed/file.tar.gz /path/to/compress ...
12
votes
2answers
882 views

Fastest way of working out uncompressed size of large GZIPPED file

Once a file is gzipped, is there a way of quickly querying it to say what the uncompressed file size is (without decompressing it), especially in cases where the uncompressed file is > 4GB in size. ...
1
vote
1answer
43 views

Is there a difference between gunzip -c and gunzip in terms of system utilization?

Is there a difference between zcat/gunzip -c and gunzip apart from the obvious one that one outputs it to the terminal and the other decompresses it to a file? I'm looking from a CPU utilization ...
1
vote
3answers
144 views

Gunzip in range of files

I'm running a long copy of .gz files from one server to another. At the same time, I'd like to unzip the files already copied. For example, al filenames that start with a through filenames starting ...
2
votes
2answers
196 views

How to gunzip files present in multiple subdirectories in subdirectories

I am learning Linux and I was trying the gzip command. I tried it on a folder which has a hierarchy like Personal/Folder1/file1.amr Personal/Folder2/file2.amr Personal/Folder3/file3.amr ...
-1
votes
2answers
93 views

Gzip Mutliple files using single command [closed]

Want to Gzip my all the .csv files into a gzip file. I am using this command. gzip *.csv; Problem File contains '//' in its name that's why command is giving error. Error : - '//File.csv' is not ...
0
votes
0answers
148 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
68 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
485 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 > ...
3
votes
1answer
656 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
3k 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 ...
1
vote
2answers
211 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): ...
3
votes
1answer
258 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 > ...
10
votes
1answer
2k 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, ...
8
votes
5answers
1k 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
463 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
673 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
77 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
191 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 ...
3
votes
2answers
5k views

Unzipping a .gz file without removing the gzipped file

I have a file 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 ...
2
votes
2answers
335 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 ...
4
votes
2answers
690 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
2k 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
199 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 ...