Tag Info

Hot answers tagged

84

You're looking for: gzcat x.txt.gz >x.txt The gzcat command is equivalent to gunzip -c which simply writes the output stream to stdout. This will leave the compressed file untouched. So you can also use: gunzip -c x.txt.gz >x.txt Note that on some systems gzcat is also known as zcat so run like this instead: zcat x.txt.gz >x.txt


51

TAR creates a single archived file out of many files, but does not compress them. Format Details A tar file is the concatenation of one or more files. Each file is preceded by a 512-byte header record. The file data is written unaltered except that its length is rounded up to a multiple of 512 bytes and the extra space is zero filled. The end of an ...


49

Or how about using the shell with advanced completion capabilities (like zsh or fresh versions of bash) which will complete the options for you, with comprehensive help? :)) Regarding tar: just look at the "qwerty" keyboard. There are letters "zxcvf" next to each other. You need either "tar czvf file.tar.gz files" or "tar xzvf file.tar.gz".


45

You have two choices: cd /root/Desktop/folder tar zxf /root/Documents/file.tar.gz or tar zxf file.tar.gz -C /root/Desktop/folder


30

You can the -c option which writes the output to stdout, and then pipe it to the file of your choice: gunzip -c compressed-file.gz > decompressed-file More details on the manual page.


22

Tar option summary Y'all are welcome to edit this to add more esoteric switches but here are the basics: x - extract files c - create archive t - list files v - verbose (list files as it processes them) j - use bz2 compression z - use gz compression f - read or write files to disk Examples Uncompress a tar.gz file: tar zxf ...


18

You can use 7-zip to untar the .tar file. I do that all the time.


13

A simpler solution is to just use gunzip as a filter like this: gunzip < myfile.gz > myfile


11

Gzip / Bzip2 are stream compressors. They compress a stream of data into something smaller. They could be used on individual files, but not on groups of files on their own. Tar on the other hand has the ability to turn a list of files, with paths, permissions and ownership information, into a single continuous stream - and vice versa. That's why, to ...


8

Tar is in charge of doing one and only one thing well: (un)archiving into(out of) a single archive file. Of what? Of one and only one thing: a set of files. Gzip is in charge of doing one and only one thing well: (un)compressing. Of what? Of one thing and one thing only: a single file of any type... and that includes a file created with tar. It goes back ...


6

Just type tar --help and there's your cheatsheet.


6

7-zip should work for you. I believe you have to untar the .tar part of the file as a second step after unzipping the .gz part. You also may need to check your 7-zip settings... Click Tools → Options Go to the “System” tab. Make sure “tar” and “gz” are checked off.


6

To undo this, use the opposite command: gunzip -r ./ Note that the original gzip command will skip over files that already have a .gz suffix, because there's no point in compressing them twice. However, the above gunzip command will decompress such files, because it doesn't know that gzip skipped them.


5

zgrep (or, we believe, grep with the -Z flag) will let you grep the compressed files and I think will tell you much of what you want, but this doesn't give you the filename without a bit more work looking at the header :(


5

You can use this command tar -cvzf tarname.tar.gz a b c eg: x@x:/tmp/aas$ touch a b c x@x:/tmp/aas$ ls a b c x@x:/tmp/aas$ tar cvzf tarname.tar.gz a b c a b c x@x:/tmp/aas$ ls a b c tarname.tar.gz x@x:/tmp/aas$ rm a b c x@x:/tmp/aas$ ls tarname.tar.gz x@x:/tmp/aas$ gunzip -c tarname.tar.gz | tar xvf - a b c x@x:/tmp/aas$ ls a b c tarname.tar.gz ...


5

You can use 7-zip to work with gzip files on 64-bit Windows.


5

First of all, TAR wasn't created to create file archives. It's Tape ARchiver. It's job is to write out or load in an archive to/from tape. The -f option makes it use a file as "virtual tape", which can then be compressed by another program. In fact, such compression happens on real-world tapedrives as well. Of course, the philosophy of using one program to ...


5

Really with a frequent usage I make difference between extracting (x) data and compressing (c) data: To extract: tar xzf data.tgz To compress: tar czf data.tgz Furthermore you can add two functions too your .bashrc : function extract () { if ($# -ne 1); then echo "Usage: $0  `<compressed archive>"` ...


5

Adding SHA1 sum (which mathematically guarantees to a ridiculously high degree of certainty that the files either match when the hashes match, and the hashes don't match when the files don't match) adds a measure of data integrity to guard against cases where the disk subsystem might have made a (silent) mistake while writing. Silent corruption is rare but ...


4

Try the following in powershell (after going to the correct directory): $files = get-childitem foreach ($file in $files) {gzip $file} That will go through all the files in the directory, and compress all of them. Edit: If you want to do all of the files in a directory tree (i.e. in a folder and all its subfolders) just change $files = get-childitem to ...


4

If the import tool can read from a pipe you could use zcat $> zcat dump.sql.gz | import_tool


4

Use the -c option to uncompress the file to stdout. It will not touch the original file. gunzip -c myfile.gz > myfile


4

If it's actually a tarball (.tgz or .tar.gz extension), then instead of redirecting to file like all of the answers so far, you'll want to pipe it to tar, like so: gunzip -c myfile.tar.gz | tar xvf - so that you get the actual contents.


4

You either need to redirect that output to your tarball name as in: tar -c abc tt zz > tarball.tar (Careful, that will overwrite tarball.tar if it's already there) or you need to use the -f flag for tar and specify a filename as in: tar -cf tarball.tar abc tt zz


4

Found in Unix script to search within a .tar or .gz file : The script : for file in $(tar -tzf file.tar.gz | grep '\.txt'); do tar -Oxzf file.tar.gz "$file" | grep -B 3 --label="$file" -H "string-or-regex" done will respect file boundaries and report the file names. The | grep '\.txt part can be adapted to your needs or dropped. (-z tells tar it is ...


3

tar -czf /a/b/c.tar.gz -C /e/f/g . The -C option makes tar change the working directory, so you only need to add .. See: Changing the Working Directory – GNU tar manual


2

I would use a for loop. Are you concerned that the executable will be loaded many times? That should not be much, compared to the time taken to compress.


2

You don't need to install the windows version of tar and gzip, you just need to download 3 zip files, one which contains binaries for tar, one with the binaries for gzip and lastly the other contains the dependancies. Unpack the files, and follow the manual installation instructions, which tells you which files to copy from the dependency directory to the ...



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