S
S
Sergey Chi2015-11-26 19:37:31
linux
Sergey Chi, 2015-11-26 19:37:31

Why do special characters appear in a text file after it is archived with tar gzip?

Hello! I create an archive of a text file with the command:
tar -zcvf file.gz file.txt
But after I unzip it, special characters like: appear at the beginning and end of the source file:

00\00\000000644\000000766\000000766\0000000136472\0012625622023\00015132\00 0\00\00\00\

Is it possible to somehow delete them when unzipping or initially archive the file so that these characters do not appear?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AVKor, 2015-11-27
@sergeychi3

Do not archive it, but compress it. Compression utilities are used for this: gzip, bzip2, etc.

M
Mystray, 2015-11-26
@Mystray

How do you unpack it?
It looks like you're using tar -czf a bit wrong, it produces a gz-compressed tar file, i.e. you get .tgz (or .tar.gz, which is the same). Accordingly, you also need to unpack it either immediately through tar -xzf or first through gunzip then through tar -xf

O
Oleg Tsilyurik, 2015-11-26
@Olej

at the beginning and end of the source file appear special characters like:

Nothing appears anywhere:
$ tar -zcvf file.tgz file.txt
$ tar -zxvf file.tgz

tar - turns the file structure into a "magnetic tape format", tar itself has nothing to do with archiving at all.
If you only need to archive 1 file - don't use tar at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question