An archive file format (and the program that reads it) commonly used on Unix and Linux.

learn more… | top users | synonyms

170
votes
18answers
16k views

What is the advantage of using 'tar' today?

I know that tar was made for tape archives back in the day, but today we have archive file formats that both aggregate files and perform compression within the same logical file format. Questions: ...
48
votes
15answers
42k views

Untar, ungz, gz, tar - how do you remember all the useful options?

I am pretty sure I am not the only one with the following problem: every time I need to uncompress a file in *nix I can't remember all the switches, and end up googling it, which is surprizing ...
47
votes
5answers
56k views

How to password protect gzip files on the command line?

I want to create some tar.gz (and possibly tar.bz2) files, using the tar command on Ubuntu 10.04. I want to password protect the file. What is the command to do this (I have Googled, but found ...
43
votes
4answers
47k views

How to specify level of compression when using tar -zcvf?

I gzip directories very often at work. What I normally do is tar -zcvf file.tar.gz /path/to/directory Is there a way to specify the compression level here? I want to use the best compression ...
42
votes
6answers
24k views

Is there a way to see any tar progress per file?

I have a couple of big files that I would like to compress. I can do this with for example tar cvfj big-files.tar.bz2 folder-with-big-files The problem is that I can't see any progress, so I don't ...
34
votes
5answers
11k views

Linux / OS X tar incompatibility – tarballs created on OS X give errors when untarred in Linux

When I tar up files on my Macbook and untar them in Linux, I repeatedly get the following warnings/errors: tar: Ignoring unknown extended header keyword `SCHILY.ino' tar: Ignoring unknown extended ...
29
votes
4answers
6k views

gzip without tar? Why are they used together?

Why are tar and gzip almost always used together, and not just gzip? Is there any advantage to that method?
29
votes
1answer
51k views

How do I unzip a tar gz archive to a specific destination?

I want to unpack a .tar.gz file to a specific directory. The archive file is in /root/Documents. I want to unzip it into /root/Desktop/folder. The folder structure in zipped file should be preserved ...
26
votes
7answers
42k views

tar: Exiting with failure status due to previous errors

I have written a little script that tars and compresses a list of directories + files. The script appears to run succesfully, in that a useable .tar.gz file is created after the script runs. ...
24
votes
5answers
8k views

Why do I get files like ._foo in my tarball on OS X?

When I tar certain files in OS X: tar cvf foo.tar foo It produces an extra file ._foo in the tarball: ./._foo foo which only shows up if I extract it on a non-Mac operating system. But ._foo ...
22
votes
7answers
38k views

Which is more efficient - tar or zip compression? What is the difference between tar and zip?

I'm working in Linux environment and want to know about tar and zip commands. Which is more efficient - tar or zip? I also need to know the differences between the tar and zip commands. Can anyone ...
19
votes
5answers
17k views

tar – extract discarding directory structure

unzip has a nifty option -j, whereby the directory structure of the archive is discarded, and all files are extracted into the same directory. Is there a way of making tar work in the same way? ...
18
votes
7answers
14k views

How can I create a zip / tgz in Linux such that Windows has proper filenames?

Currently, tar -zcf arch.tgz files/* encodes filenames in UTF, so Windows users see all characters spoiled in filenames which are not english, and can do nothing with it. zip -qq -r arch.zip files/* ...
18
votes
9answers
248k views

How to extract a tar file (.tgz) in windows?

How to extract a tar file (.tgz) in windows? Is this possible, or do I have to get into a linux environment and extract it?
16
votes
4answers
9k views

TAR vs CPIO, what is the difference?

I am curious and did a bit of reading but still have questions. What makes CPIO different than TAR? I was told in another question that tar is for pulling together many files into 1 archive which ...
16
votes
4answers
2k views

Undo tar file extraction mess

I just untar'd an archive that produced a mess of files into my tidy directory. For example: user@comp:~/tidy$ tar xvf myarchive.tar file1 file2 dir1/ dir1/file1 dir1/subdir1/ dir1/subdir1/file1 ...
15
votes
3answers
5k views

Get mac tar to stop putting ._* filenames in tar archives [duplicate]

Possible Duplicate: Why do I get files like ._foo in my tarball on OS X? I create autoconf scripts on a Mac. When tar runs, it puts all of these ._foobar names in the archive: ...
14
votes
5answers
25k views

Extract 7z files with standard linux tools?

I know that you can extract .7z files with 7-zip. Is there another standard linux program that can do this? Maybe one of these tar bzip2 xz gzip I will add that bsdtar can do this, but is not ...
13
votes
4answers
3k views

How do I create a tar file in alphabetical order?

I want to create a tar file where all of the directories and files are processed in alphabetical order. This is for the entire directory hierarchy that's being tarred up, so it would start by ...
12
votes
3answers
38k views

How to create tar archive split into, or spanning, multiple files?

According to this page, one can let tar create a tar archive "split" into 100 Mb files: tar -c -M --tape-length=102400 --file=disk1.tar largefile.tgz The problem is that this command will ...
12
votes
5answers
8k views

SVN directly to tar

Is there a way to directly tar the latest version of an SVN folder without the SVN hidden files? I would like to create a tar archive without the SVN files. I know you can get the latest with the SVN ...
12
votes
2answers
7k views

unpack 'tar' but change directory name to extract to

tar -tf filename.tar folder1/file folder1/name [...] I'd like to extract file and name to, folder2. Can this be done as a one-liner?
12
votes
2answers
11k views

How can I create multipart tar file in Linux?

How can I create a multipart tar file in Linux?
12
votes
5answers
11k views

.tar files without directory structure

I'm .taring some files with the path example/super_user/Output.*. The resulting .tar looks like this: + example + super_user - Output.zip - Output.xml - Output.txt ...
12
votes
1answer
242 views

Three formats? Why?

I needed to download the Ruby Source recently from here and it says, "available in three formats" which are .tar.bz2, .tar.gz and .zip. Is there any reason that we need all three formats? At least on ...
12
votes
3answers
7k views

How to use password protection with the Linux tar command?

How can I use password protection with the tar command in Linux? I'm new to Linux so please explain to me with simple usage.
11
votes
5answers
3k views

Map “untar” to tar xvfz?

How can I map 'untar' as a command to 'tar -xvfz' ? Sorry, but I almost always forget the arguments necessary to 'tar' for this operation.
11
votes
2answers
485 views

Compressing many similar big files

I have hundreds of similar big files (30 megabyte each) which I want to compress. Every pair of files have 99% of same data (less then 1% difference), so I expect to have not more than 40-50 megabyte ...
11
votes
2answers
7k views

Forcing “tar” to create an empty archive

I am making an RPM in which everything is contained in the .spec file (don't ask :-). rpmbuild requires a "Source" file, so I was trying to create an empty tar file. However, if I don't give any ...
10
votes
4answers
14k views

How to obtain maximum compression with .tar.gz? [duplicate]

The way i understand the use of tar + gzip is that tar is normally used to consolidate a grouping of files into a single file, then gzip is used to compress that file. I recently learned that tar can ...
10
votes
2answers
21k views

Linux Bash Script, Single Command But Multiple Lines?

I have the following script I wrote by searching Google, and it backs up my Linux system to an archive: #!/bin/bash # init DATE=$(date +20%y%m%d) tar -cvpzf ...
10
votes
1answer
8k views

How can I force only relative paths in “find” output?

I am attempting to create a script that can compress files with a certain extension in a number of directories into a single tar-ball. Currently what I have in the script file is: find "$rootDir" ...
9
votes
5answers
70k views

How to open a .tar.gz file in Windows?

I need to open a file that sadly is only available in the .tar.gz file format and I am using Windows 7. I can unzip the file using 7-zip but after that I still have a .tar file that I can't open in ...
9
votes
2answers
21k views

Howto pipe: cp | tar | gzip without creating intermediary files?

Can anyone tell me if it's possible to pipe | this without having to create a physical file anywhere between A and B.tar.gz? This is what I'm trying to do: File A Rename A to B Tar B.tar gzip -9 ...
9
votes
3answers
4k views

Is it possible to mount a .tar file?

The only result of any import when I searched for this was from 2001. In the intervening decade, have any tools/methods for mounting a tar file as a filesystem (perhaps utilizing fuse) been created? ...
9
votes
2answers
518 views

let tar auto detect compression type when extracting from stdin

I use GNU tar. It can auto detect compression type when compressing/decompressing files. But I need to decompress an archive from stdin and the compress type is unknown. I noticed that tar can give me ...
8
votes
3answers
6k views

How do I convert tar.bz2 to tar.gz?

I'm new in Linux, is this conversion possible? Do I need to compress and decompress all content?
8
votes
4answers
3k views

In place extract tar archive

I have a little dilemma here... I needed to move about 70 GB worth of files from one of my servers to the other, so I decided that tarring them up and sending the archive would be the fastest way. ...
8
votes
3answers
3k views

Is there a way to mount a file.tar.bz2 without extracting it onto the filesystem?

Is there a way to mount a file.tar.bz2 without extracting it onto the filesystem? I don't care if the mount is read only. Hopefully your answer will also apply to file.tar.gz. "mount" in this ...
7
votes
4answers
597 views

Tar and gzip together, but the other way round?

Gzipping a tar file as whole is drop dead easy and even implemented as option inside tar. So far, so good. However, from an archiver's point of view, it would be better to tar the gzipped single ...
6
votes
2answers
1k views

tar a directory

I'm trying to tar my website files that are on my test server to be able to upload them to 'real' server. tar -cf mysite.tar /var/www It creates archive fine... but when I open that archive it has ...
6
votes
1answer
7k views

How can I use tar command to group files without compression?

I have a very large folder of 120,000+ files. and I need to move them to another location on my same machine (same partition). I'd like to use the tar command to group them up as a single unit and ...
6
votes
5answers
28k views

How to tar directory and then remove originals including the directory?

I'm trying to tar a collection of files in a directory called 'my_directory' and remove the originals by using the command: tar -cvf files.tar my_directory --remove-files However it is only ...
6
votes
2answers
2k views

How to split a tar file into smaller parts at file boundaries?

I have a tar file that I want to split into multiple smaller tar files. This would be easy with split, but I want the splitted files to be fully usable tar files themselves, which split can't do as it ...
6
votes
3answers
9k views

How can I remove the leading path from a tar and retar it in memory?

I was thinking I could do something like this: wget -O- http://example.com/funky.tar.gz | \ tar --strip-components 1 -Ox | tar -cf fixed.tar.gz to remove the leading path from all items in the ...
5
votes
4answers
18k views

How do I password protect a .tgz file with tar in Unix?

I'm using the Unix tar command as follows to tar up a directory and its files: tar cvzf fileToTar.tgz directoryToTar Is there a way to password protect the .tgz file? I've created ...
5
votes
2answers
2k views

Why can't -z be the last command-line option to be used with tar?

$ ls one.tar.gz one.tar.gz $ tar -xvfz one.tar.gz tar: z: Cannot open: No such file or directory tar: Error is not recoverable: exiting now $ tar -xvzf one.tar.gz one $ tar -xzvf one.tar.gz one $ tar ...
5
votes
4answers
7k views

Extract file and folders with specified permissions

I pack a folder with lot of sub-folders and files in Windows with 7zip, upload to VPS and then run the command: tar -xvzf file.tar.gz then all unpacked files and folders have permissions of 777. ...
5
votes
2answers
7k views

What is the fastest compression method for a large number of files?

I need to compress a directory with around 350,000 fairly small files that amount to about 100GB total. I am using OSX and am currently using the standard "Compress" tool that converts this directory ...
5
votes
5answers
2k views

How to do the equivalent of “grep something * -Rin” on list of tar.gz files?

I've got a bunch of tar.gz files and I want to do a "grep something * -Rin" as I would on them if they weren't tar.gzed. I want to keep them tar.gzed as they are, but grep on them on-the-fly and find ...