The tar archive format and/or the command-line utility for working with tar files.

learn more… | top users | synonyms

5
votes
3answers
22k views

How do I extract with tar to a different directory?

This doesn't work: tar xf /tmp/foo.tar.gz foo/bar tar: foo/bar: Not found in archive It's not obvious to me what would do this beyond extracting it in place and moving the files over.
1
vote
1answer
2k views

Updating tar.gz daily only with changed files [duplicate]

Possible Duplicate: Add/update a file to an existing tar.gz archive? I have some game files I wish to update daily and they create a tar.gz of the folder, but instead of making a full ...
3
votes
1answer
659 views

Copy just permissions and ownership from one tar file to another

I have two tar files which are basically backups of my /data folder on android. The problem is the permissions and ownership of the files inside latest back-up is messed up. However the permissions in ...
2
votes
2answers
935 views

How do I dereference links when extracting from a tar file?

If I have a tar file, bob.tar, which contains real_file and link_to_real_file, in which the latter is a symlink, is there a way to extract the contents of bob.tar so that link_to_real_file will not be ...
5
votes
2answers
10k views

tar with relative paths

I try to create an archive with tar using relative paths. I use the following command: tar czf ~/files/wp/my-page-order.tar.gz -C ~/webapps/zers/wp-content/plugins/ ...
10
votes
5answers
6k views

“tar: unrecognized option --warning” during 'apt-get install'

I just ran apt-get upgrade on my debian 5 vps and I got this error: tar: unrecognized option `--warning=no-timestamp' Now when I try to install other packages e.g: imagemagick I get the same ...
0
votes
1answer
587 views

Proper way to join multi-volume tarballs?

So how should this be done? I have learned that using cat is the preferred way when using split to create multi-volume files, but what about when using tar's own native multi-volume function? Thanks
7
votes
2answers
4k views

Can I automate tar's multi-volume-feature?

Ok, so I've just had a read through this page after a way to improve my current backup solution on my Debian server. Tar seems to be offering a quite nice multi-volume feature, although when I try it ...
6
votes
2answers
9k views

Extract multiple .tar.gz files with a single tar call

I was wondering whether (and, of course, how) it’s possible to tell tar to extract multiple files in a single run. I’m an experienced Unix user for several years and of course I know that you can use ...
3
votes
1answer
3k views

Compress a directory using tar/gz over SSH to local computer?

I'd like to essentially tar/gz a directory on a remote machine and save the file to my local computer without having to connect back into my local machine from the remote one. Is there a way to do ...
5
votes
2answers
810 views

What do these commands (`tar`) actually do? Is there a better way?

I am going over some documentation pertaining to creating a distro repo. However, I cannot understand exactly what these commands perform: # cd /mnt/ # ls centos-1 centos-2 centos-3 # for i in 1 2 ...
8
votes
2answers
3k views

Fastest way combine many files into one (tar czf is too slow)

Currently I'm running tar czf to combine backup files. The files are in a specific directory. But the number of files is growing. Using tzr czf takes too much time (more than 20 minutes and ...
4
votes
2answers
3k views

Tar a folder without .git files?

If I tar a folder that is a git repository, can I do so without including the .git related files? If not, how would I go about doing that via a command?
4
votes
4answers
316 views

Generating sets of files that fit on a given media size for tar -T

Can anyone suggest a script that will take as input the name of one or more directories and a media size, and output lists of files for input to tar using -T (assuming no compression)? ...
6
votes
6answers
13k views

How can i view the contents of a tar.gz file (filenames + filesize)

I cannot use tar -tz as the solaris version I'm using does not accept the -z option. I tried something like gunzip file.tar.gz | tar -tv but that only gives: tar: /dev/rmt/0: No such file or ...
3
votes
3answers
6k views

How to recover a corrupted “tar.gz” file

I suddenly needed to recover an old tar.gz file, but as soon as I execute so: tar -zxvf filename.tar.gz I get this: gzip: stdin: invalid compressed data--format violated tar: Child returned ...
4
votes
2answers
982 views

diff a gzipped tarball against a directory?

Is there a way I can diff a gzipped tarball against an existing directory? I would like to be able to do it without extracting the data from the tarball.
1
vote
2answers
3k views

fastest way of doing a tar.gz from a tree of directories?

I've got a tree of directories with files like this: . |-- 00 | |-- 00 | | |-- 00 | | |-- 01 | | |-- 02 | | |-- 03 | | |-- 04 | | |-- 05 [..] | | |-- 97 | | |-- 98 ...
6
votes
3answers
4k views

How do you verify a tar archive that is already written?

I know that you can do -W when creating an archive, but how do you verify and already-created archive? tvWf says it's not a valid tar archive? $ mkdir tmp $ echo asdkfjh > tmp/a $ echo qweroiu ...
10
votes
1answer
7k views

Prevent showing time stamp message when running “tar xzf”

When running tar xzf, how to prevent this message (Prevent showing time stamp message): tar: node: time stamp 2011-06-07 02:02:30 is 8309 s in the future tar: user/Node: time stamp 2011-06-07 ...
6
votes
4answers
3k views

howto inflate AND extract a .tar.bz2 using the 7-zip command line tool

I have a .tar.bz2 file that I want to be decompressed and extracted via the 7-zip commandline tool. So basically I'm looking for the equivalent of tar -xjf foo.tar.bz2 with 7-zip there is only the ...
14
votes
3answers
2k views

Why use superflous dash (-) to pass option flags to tar?

To create a tar file for a directory, the tar command with compress, verbose and file options can be typed thus: $ tar -cvf my.tar my_directory/ But it also works to do it this way: $ tar cvf ...
3
votes
2answers
952 views

Find files with same name but different extensions, send to tgz

I have a large archive of edited images from my camera, each image is actually a pair of files - *.nef & *.xmp. I would like to go through all the folders and then zip these pairs into single tgz ...
8
votes
4answers
4k views

tar extraction depends on filename?

I often download tarballs with wget from sourceforge.net. The downloaded files then are named, e.g ...
21
votes
3answers
48k views

Add/update a file to an existing tar.gz archive?

Is there a way to add/update a file in a tar.gz archive? Basically, I have an archive which contains a file at /data/data/com.myapp.backup/./files/settings.txt and I'd like to pull that file from the ...
20
votes
3answers
8k views

How to choose directory name during untarring

Say I have file named ugly_name.tar, which when extracted, becomes ugly_name directory. What command can I use such that the resulting directory name is pretty_name instead?
1
vote
4answers
454 views

Compare the contents of dynamically generated archives

Short question: I have two dynamically generated tar archives (so they have different timestamps), how can I compare them, ignoring any different in time? Backgrounds... I am doing some backup, in ...
1
vote
2answers
253 views

tar through ssh session [duplicate]

Possible Duplicate: What does “-” mean as an argument to a command? When I use this command: tar cf - /tmp | ssh test.com tar xf - What does the '-' mean? And is this the ...
20
votes
5answers
12k views

How can I best copy large numbers of small files over scp?

I have a directory that's got several gigabytes and several thousand small files. I want to copy it over the network with scp more than once. CPU time on the source and destination machines is cheap, ...
12
votes
4answers
7k views

Create tar archive of a directory, except for hidden files?

Here's a newb question. I'm wanting to create a tar archive of a specific directory (with its subdirectories of course). But when I do it, using the tar command, I get a list of files that were ...
9
votes
2answers
1k views

What does “-” mean as an argument to a command?

I found this link on how to open tgz in one step. gzip -dc target.tar.gz | tar xf - What does the '-' mean?
0
votes
4answers
2k views

Copy a directory to external HDD

I'm trying to copy a directory to external HDD- i mounted the device and then typed : cd root tar -cf - * | (cd /mnt ; tar -xpf -) I got this error message: "cowardly refusing to create an empty ...
2
votes
3answers
1k views

untar a directory of *.tgz files using a wildcard

I've got a directory that looks like $ ls Broad_hapmap3_r2_Affy6_cels_excluded.tgz DINGO.tgz GIGAS.tgz index.html IONIC.tgz passing_cels_sample_map.txt ...
0
votes
1answer
125 views

Locate a directory within an archive

I have .tgz archive i'm trying to locate a directory within it to extra how do i search within a .tgz i tried the following below but no luck. tar -tzf archive-9.tgz | grep '161519' | xargs tar -Oxzf ...
11
votes
2answers
912 views

Tar up all PDFs in a directory, retaining directory structure

I'm trying to create a compressed tarball that contains all PDF files that exist in one of my directories. The directory structure needs to be retained. Empty directories are not needed, but I really ...
12
votes
5answers
1k views

How to de-unzip, de-tar -xvf — de-unarchive in a messy folder?

Usually, I unarchive things by $ mkdir newFolder; $ mv *.zip newFolder; $ cd newFolder; $unzip *.zip but sometimes I get lazy and just do in an arbitrary folder $ unzip *.zip so time-to-time messing ...
5
votes
2answers
9k views

How do I extract a specific directory from a tarball? and strip a leading directory?

I want to extract a specific directory from the wordpress tarball. specifically wp-includes to .. It appears that the directory structure inside the tarball is wordpress/wp-includes but I just ...
15
votes
5answers
8k views

Is there a parallel file archiver (like tar)?

Is there something out there for parallel archiving of files? Tar is great, but I don't use tape archives, and it's more important to me that the archiving happens quickly (with compression like ...
5
votes
3answers
1k views

What does the -f parameter do in the tar command

When using tar I always include -f in the parameters but I have no idea why. I looked up the man and it said; -f, --file [HOSTNAME:]F use archive file or device F (default "-", meaning ...
13
votes
7answers
8k views

What to use to backup files, preserving ACLs?

When using the tar utility to store files in backups one loses the extended ACLs. Is there some commonly used and not hackish solution (like: create a script that will recrate the ACLs from scratch) ...
6
votes
4answers
2k views

How do I use the Unix tar command with an implicit filepath?

I am using the tar -xvf command and it is taking the explicit path. However, the path is full. Example: tar -xvf 13.2.tar It is taking the path of /mnt folder. The / folder is full. How can I tar ...