1

If there any way to see if there is a problem with the .tar.bz2 file? As you can see, I can get a list of files, but neither xjvf nor xzvf works in this case.

$ tar tf pytorch.20210702.tar.bz2 | head -n 5 pytorch/ pytorch/BUILD.bazel pytorch/requirements-flake8.txt pytorch/NOTICE pytorch/WORKSPACE $ tar xjvf pytorch.20210702.tar.bz2 bzip2: (stdin) is not a bzip2 file. tar: Child returned status 2 tar: Error is not recoverable: exiting now $ tar xzvf pytorch.20210702.tar.bz2 gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now 
0

2 Answers 2

2

bzip2: (stdin) is not a bzip2 file

This tells you the file is not compressed with bzip2. Therefore, the .bz2 extension is misleading and tar's -j option should not be used.

gzip: stdin: not in gzip format

This tells you the file is not compressed with gzip. Therefore, tar's -z option should not be used.

If you want to know the compression method, and thus know what tar option to use, you can use the file command:

file pytorch.20210702.tar.bz2 

That said, your first attempt with tar tf seems to work so why not consider that your tar file is not compressed at all?

Even if it was compressed, nowadays tar uses auto-detection to guess the compression method and this would likely work here.

Just try:

$ tar xvf pytorch.20210702.tar.bz2 
1

You could use

file filename

to find out what the real compressor is. Then you man compressor to find out how to verify the file integrity, normally it's the -t switch, i.e. xz -t or bzip2 -t.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.