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.
Related
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 ...
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.
When i create the archive of a text file with this command:
tar -zcvf file.gz file.txt
and then i extract it get some strange characters in the begin and in the end of file like these:
\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\000000644\
How can i remove them? Is it any case to create archive of the one single text file without these special characters?
tar cfz creates a gzipped tar: file.tar.gz. It is the same as tar cf file.tar followed by gzip file.tar.
Extract such a file with tar xvfz (or gunzip file.tar.gz && tar xvf file.tar, but the z is shorter).
For single files use gzip and gunzip (possibly with -k or --keep to keep the original file).
I have the following archived directory:
itunes20140618.tbz
I want to extract single file from it called:
itunes20140618/video
How would I do this?
So far, I am doing
$ bzip2 -d /tmp/itunes20140618.tbz
But it seems to create a tar directory of everything. How would I extract just the single video file?
There are a few different versions of tar around, but on my machine I can do this:
tar xjf archive.tbz filename
To extract filename from archive.
If that doesn't work you can use:
bzip2 -dc archive.tbz | tar xvf - filename
Which uses bzip2 to extract to stdout and then pipe to tar.
In both cases you can replace the x option with t to get a list of files. Eg:
tar tjf archive.tbz
You can use the tar command and pass the path of the desired file or folder as an argument to it:
tar xjf test.tbz /path/to/file/in/archive
Possible Duplicate:
gzipping up a set of directories and creating a tar compressed file
This post describes how to gzip each file individually within a directory structure. However, I need to do something slightly different. I need to produce one big gzip file for all files under a certain directory. I also need to be able to specify the output filename for the compressed file (e.g., files.gz) and overwrite the old compressed file file if one already exists.
tar -zcvf compressFileName.tar.gz folderToCompress
everything in folderToCompress will go to compressFileName
Edit: After review and comments I realized that people may get confused with compressFileName without an extension. If you want you can use .tar.gz extension(as suggested) with the compressFileName
there are lots of compression methods that work recursively command line and its good to know who the end audience is.
i.e. if it is to be sent to someone running windows then zip would probably be best:
zip -r file.zip folder_to_zip
unzip filenname.zip
for other linux users or your self tar is great
tar -cvzf filename.tar.gz folder
tar -cvjf filename.tar.bz2 folder # even more compression
#change the -c to -x to above to extract
One must be careful with tar and how things are tarred up/extracted, for example if I run
cd ~
tar -cvzf passwd.tar.gz /etc/passwd
tar: Removing leading `/' from member names
/etc/passwd
pwd
/home/myusername
tar -xvzf passwd.tar.gz
this will create
/home/myusername/etc/passwd
unsure if all versions of tar do this:
Removing leading `/' from member names
#amitchhajer 's post works for GNU tar. If someone finds this post and needs it to work on a NON GNU system, they can do this:
tar cvf - folderToCompress | gzip > compressFileName
To expand the archive:
zcat compressFileName | tar xvf -