Questions tagged [tar]

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

Filter by
Sorted by
Tagged with
226 votes
6 answers
280k 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 ...
Lazer's user avatar
  • 17.7k
80 votes
6 answers
33k 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 doesn'...
Jesse Beder's user avatar
  • 1,811
50 votes
3 answers
31k 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: libewf-20110312/...
vy32's user avatar
  • 3,381
44 votes
5 answers
82k 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? ...
Benji XVI's user avatar
  • 543
206 votes
17 answers
262k 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 ...
Svish's user avatar
  • 39.6k
141 votes
8 answers
264k views

How can I unzip a .tar.gz in one step (using 7-Zip)?

I am using 7-Zip on Windows XP and whenever I download a .tar.gz file it takes me two steps to completely extract the file(s). I right-click on the example.tar.gz file and choose 7-Zip --> Extract ...
quickcel's user avatar
  • 4,829
132 votes
10 answers
618k 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 ...
Jonas's user avatar
  • 27.6k
45 votes
3 answers
78k views

How do I tar ball a directory hierarchy with soft links in Linux?

How do I tar ball/compress a directory hierarchy with soft links in Linux?
michael's user avatar
  • 5,955
40 votes
4 answers
43k views

How to get an empty tar 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 ...
Sean Reifschneider's user avatar
28 votes
6 answers
36k 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/* ...
kolypto's user avatar
  • 3,081
16 votes
5 answers
12k 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. ...
anonymous coward's user avatar
12 votes
2 answers
20k views

tar - exclude certain files

I wish to tar all files in a directory and its subdirectories that do NOT end in .jpg, .bmp, .gif, or png. So, given the following folders and files: foo/file.txt foo/file.gif foo/bar/file foo/bar/...
Alan's user avatar
  • 123
12 votes
2 answers
7k views

List contents of tarball in tree format

Per the answers here I'm able to list the contents of my tarball in ls format. However, I'd like to be able to list them in tree format, i.e. something like the latter instead of the former: With tar:...
Vasu's user avatar
  • 233
8 votes
3 answers
45k views

tar Cannot open: No such file or directory

Fresh install of CentOS 5.4 Downloaded the following: http://prdownloads.sourceforge.net/webadmin/webmin-1.510.tar.gz MD5 sum is correct (cdcc09d71d85d81914a90413eaf21d3f). The file is located here:...
Jake Wilson's user avatar
  • 4,424
4 votes
2 answers
20k views

How to extract a single folder and its subfolders from a "tarball" (.tar.gz)

I need to extract a single folder and its subfolders from a tarball (.tar.gz) on a CentOS server. I haven't the slightest clue how to do it using an SSH terminal. I tried: gunzip -c files_20100623....
mikey1980's user avatar
  • 173
148 votes
1 answer
270k 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 ...
alwbtc's user avatar
  • 2,955
87 votes
2 answers
260k views

How to tar a directory preserving not only permissions, but ownership too

I have to compress a directory using tar.gz preserving not only permissions, but ownership/groups too. And, in this directory there are many files that belong to many users.
Paulo Coghi's user avatar
  • 1,214
85 votes
17 answers
104k 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 ...
81 votes
7 answers
136k 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 ...
rekha_sri's user avatar
  • 921
76 votes
6 answers
195k 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 password-...
c12's user avatar
  • 861
73 votes
5 answers
34k 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?
user541686's user avatar
  • 23.9k
50 votes
3 answers
40k 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? ...
warren's user avatar
  • 10.2k
44 votes
1 answer
188k views

Extracting a tar.gz file returns, “This does not look like a tar archive.”

I have a tar.gz file and I want to extract it using terminal. I used following commands: tar tvzf ldtp_3.5.0.orig.tar.gz and tar -xvzf ldtp_3.5.0.orig.tar.gz. However, I get the same result for both ...
TheRookierLearner's user avatar
43 votes
3 answers
79k views

How to tar/untar the output on the fly

What is the idiomatic way to do the following tar to stdout read this tar output from stdout and extract to some other folder. My solution is tar --to-stdout .. | tar -C somefolder -xvf - But ...
shabunc's user avatar
  • 820
42 votes
3 answers
67k views

How do I use 7-Zip CLI for Windows to create .tar.gz archives?

How can I use the 7-Zip CLI (7za.exe) on Windows to create .tgz archives, as I use tar zcvf archive.tgz source_files on Linux?
f.ardelian's user avatar
31 votes
7 answers
97k 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 ...
Samuel Lampa's user avatar
27 votes
5 answers
56k views

tar -C with a wildcard file pattern

Can I use the tar command to change directories and use a wildcard file pattern? Here is what I am trying to do: tar -cf example.tar -C /path/to/file *.xml It works if I don't change directory (-C),...
Nick C.'s user avatar
  • 373
25 votes
3 answers
41k views

How can I create multipart tar file in Linux?

How can I create a multipart tar file in Linux?
hopeseekr's user avatar
  • 1,672
21 votes
4 answers
17k views

extract single file from huge tgz file

I have a huge tar file (about 500G) and I wan't to extract just a single file from it. However, when I run tar -xvf file.tgz path/to/file it seems like it is still loading the whole contents into ...
Brian's user avatar
  • 313
16 votes
5 answers
8k 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 ...
GlassGhost's user avatar
  • 1,269
13 votes
5 answers
58k 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. How ...
Kaspar L. Palgi's user avatar
13 votes
3 answers
21k 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?
Caio Tarifa's user avatar
11 votes
2 answers
26k views

rsync to/from tar archive

Is it possible to rsync a real filesystem (remote) with a tar archive (local)? If so, how? Problem is I need to correctly backup user/group/permission settings and, while I have root access on remote ...
ZioByte's user avatar
  • 541
9 votes
4 answers
5k 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 ...
Grumbel's user avatar
  • 3,662
8 votes
2 answers
6k 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 -...
Lazer's user avatar
  • 17.7k
7 votes
4 answers
1k 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 files....
Boldewyn's user avatar
  • 4,398
6 votes
2 answers
7k views

Chromium: prevent unpacking tar.gz

The latest Chrome and Chromium seems to unpack .tar.gz files automatically for me on OS X and Linux. When using wget with the same URL, it shows: $ wget http://mydomain/dir/file.tar.gz ... HTTP ...
Thomas S.'s user avatar
  • 793
5 votes
1 answer
18k views

Cannot Generate .tar File

How do I make a .tar from current directory tree in Win10? Trying tar -c Archive.tar * and getting tar: Failed to open '\\.\tape0'. C:\>tar -h tar(bsdtar): manipulate archive files First option ...
flywire's user avatar
  • 205
3 votes
3 answers
821 views

Weird bug in 'tar' not including files named .__init__.py

Does anyone know why tar is not including files named .__init__.py (note the dot)? $ mkdir /tmp/work && cd /tmp/work $ mkdir foo $ touch foo/.__init__.py $ touch foo/.namespace__init__.py $ ...
Sridhar Ratnakumar's user avatar
3 votes
1 answer
3k views

Is there any limit on number of file name we can pass in tar

I am creating a tar and untar it at other location using: $ tar -C sourcedir -cf - . | tar -C targetdir -xpf - but it fails like thisError I am getting is :Argument list too long - tar, when I am ...
ritzz.soni's user avatar
3 votes
2 answers
11k views

tar command - how to extract one file to specific directory

Is there a way to extract a single file from a tar file to a specific directory? In fact, I am dealing with a .tgz file so, I am attempting something like this : gunzip -c mytargzfile.tgz | tar xvf - ...
ring bearer's user avatar
3 votes
2 answers
1k views

/dev/fd0 equivalent on windows. (Writing directly to tar floppy)

I am currently using a system I cannot change that writes tar files to a floppy disk. I need to read/write the same type of disk on a windows machine. The command used to create the disk in Linux is:...
izzmit's user avatar
  • 31
3 votes
0 answers
1k views

view zip file content in tree command style [duplicate]

I am seeing the zip file content using unzip -l files.zip | less but it outputs in ls style , is it possible to to display output in tree command style
Ciasto piekarz's user avatar
3 votes
1 answer
6k views

How can I extract only some specific folders from a tar.gz archive?

Let's say I have the archive website.tar.gz, inside is the following folder structure : home -mike -www -coolwebsite file1 file2 file3 etc. When I ...
mike23's user avatar
  • 237
3 votes
2 answers
7k views

How to extract tar file on Windows, when the filenames include a colon?

I have a tar(.gz) file created on a Linux system, and the filenames contain colon characters. The tar utilities I can find on Windows don't extract these files at all. How can I do this, ideally ...
xorsyst's user avatar
  • 519
3 votes
2 answers
676 views

is it plausible that Ubuntu's wildcard * with tar is somehow failing to restore some files?

In this command line sequence I use a *.sh wildcard to restore some files. I got three hits. Knowing that there must be more, I typed in the whole name. For example: goFindRanges.sh. I was able to ...
H2ONaCl's user avatar
  • 1,428
2 votes
1 answer
4k views

Do 7z archives compress each file individually or compress everything together as one?

I read somewhere (I can't remember where) that compressing files into a .tar.xz resulted in better overall compression ratios than .7z archives because archive+compression formats like zip, rar, and ...
Nathan2055's user avatar
  • 1,220
2 votes
1 answer
1k views

tar extracting on root directory is destroying entire system

I'm not sure whats going on... I wasn't aware tar did this. But when I extract a tar on top of the root fs (/) with all the permission stuff turned off... for instance: root@system:~# tar --no-same-...
Sanchke Dellowar's user avatar
2 votes
1 answer
2k views

What makes a tar archive seekable?

It seems a tar archive being seekable can make a large difference when listing or extracting just a few files. Unfortunately the man page is really scarce on information. It seems that compressed ...
Peltier's user avatar
  • 6,304
2 votes
2 answers
738 views

Create many tar files from a directory with 500000 files

I have a directory containing around 500k files, and want to slice them into t tar files. Put formally, let's call the files file_0, ..., file_{N-1}, where N around 500k. I want to create t tar files ...
fabian789's user avatar
  • 155