how to Extract tar Files? - linux

i want to extract tar file.
but, terminal is error output.
i want to solve the error.
could you help me?
this is terminal cmd
$ tar xvzf test.tar -C /dir/
this is error output
# gzip: invalid magic
# tar: Child returned status 1
# tar: Error exit delayed from previous errors

You are running tar xzvf, which extracts a compressed tar, but the filename given is tar, which is just a tar file, not compressed. Try without the z.
tar xvf ...

Related

Issue with tar command

I downloaded a .gz file called quoth.tar.gz and was trying to extract the contents so the path is to quoth.tar.gz but it keeps giving me this error
tar -xzvf <quoth.tar.gz>.
parse near '\n'

tar czf with --remove-files and -c

When I want to tar from a dir and remove all the original files I used the below command:
tar -cvzf /xx/yy/data-backup.tar.gz --remove-files -C /aa/daily-backup/ .
All the files under /aa/daily-backup/ is tarred and removed successfully.
But on the end of the output of the terminal, it shows:
tar: /aa/daily-backup/ .: Cannot rmdir:Invalid argument
If I remove the --remove-files, this command will run successfully.
Obviously, I don't want to remove the /aa/daily-backup/, how should I revise my command?

how to tar all files in a directory and move that tar to another directory

So I have 2 directors A and B. I want to tar all the files in A and have the .tar file be sent to directory B. How can i do this?
I have tried
sudo tar -C /home/mine/A/ -cvf home/mine/B/test.tar
tar: Cowardly refusing to create an empty archive
tar -cvf /home/mine/B/test.tar /home/mine/A/
works fine for me.

Gunzip alternative to tar command

A straight-forward question:
Could you please guys give me an alternative to this tar command, using gunzip ?
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz
I want this because when I am trying to run that command I get with this:
gzip: stdin: not in gzip format tar: Child returned status 1 tar:
Error is not recoverable: exiting now
Thanks

SwiftMailer: can't open .tar.gz archives on Linux

I downloaded a couple of versions from
http://swiftmailer.org/downloads/archive
(tar.gz) but the archive manager says
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
when I try to open it. Any ideas?
Try:
gzip -d file.tar.gz
then:
tar -xf file.tar
This was taken from:
http://fosshelp.blogspot.com.au/2012/04/solution-tar-this-does-not-look-like.html
Or just tar xzf file.tar.gz. Easier, faster, and takes less disk space.
Update:
I don't see why that doesn't work, but ungzipping first does. In that case, it would be better to:
gzip -dc file.tar.gz | tar xzf -
which at least uses a pipe to avoid uncompressing and reading back from mass storage.

Resources