How to archive and extract the .tar.gz file

Simple question. In x86 Solaris 10, I tried to compress the folder (data) of files.

tar -cvf /path/to/Data/* | gzip > /path/to/archive/Data.tar.gz

Now I can specify the file names and their sizes using:

gunzip -c Data.tar.gz

However, when I try to unpack (for verification) Data.tar.gz:

gzip -d Data.tar.gz
tar -xvf Data.tar

I get a "checksum error"

Can anyone suggest the right way to compress and extract files in Solaris 10. Thanks

+4
source share
3 answers

You can make an archive in 2 steps:

$ tar cvf archive.tar file* 
$ gzip archive.tar

(He will create archive.tar.gz by deleting archive.tar.)

Extraction also in 2 stages:

$ gunzip archive.tar.gz

(He will create the archive.tar file and delete the archive.tar.gz file.)

$ tar xvf archive.tar

To view files inside a .gz file:

gzip -l archive.tar.gz

7zip, , .

7z a archive.7z Makefile* (to create archive)
7z l archive.7z           (to list files inside the archive)
7z e archive.7z           (to extract)
+16

tar cvf stdout, gzip:

tar cvf - <path> | gzip > <file>

. , /, , . gnu tar . gnu tar , gzip :

gnutar cvfz <file> <path>

, - :

tar cvf - <path> | ssh remotehost (cd <another dir>; gzip > <file>)

.

Solaris tar . . Man tar (8).

+2

( ), - stdin stdout. .

tar -cvf - data/* | gzip > data.tar.gz
gzip -dc data.tar.gz | tar -xvf -
+1

Source: https://habr.com/ru/post/1523574/


All Articles