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

learn more… | top users | synonyms

3
votes
2answers
1k views

Tar overwrites read only files

I created directory test, created file 1.txt in test, wrote 'Before' in this file. Then I went cd .. and used the command: tar -cvzf ./test.tgz ./test Then I entered the test dir again. Opened ...
3
votes
1answer
532 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 ...
3
votes
2answers
4k 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
2answers
145 views

how to include or add /dev with tar --one-file-system

I'm running tar on a complete remote filesystem using ssh -n <hostname> 'sudo tar -cpvzf - --one-file-system /' | cat > Bak.tar.gz This gave me a tarball. I tried importing this tarball ...
3
votes
1answer
230 views

Extract single file from tar to other folder

I've searched for multiple forums for this questions and have seen different answers but so far, nothing have worked yet even from the ones I've seen here. I want to extract a single file from a tar ...
3
votes
1answer
162 views

How to create a folder which will change its contents’ ownership to what the folder has?

In a GNU/Linux OS there is no way to change ownership of a file until you are root. But what if I want to hide my system’s username e.g. before sending a file to someone, because some things like tar ...
3
votes
1answer
317 views

Extract directory from wget's stdout

I am trying to wget a tarball from github.com and, without creating a temporary file, extract a subdirectory from it: wget -qO- https://github.com/django-nonrel/django-nonrel/tarball/develop | tar ...
3
votes
1answer
29 views

Is it possible to get file list, byte range from the head of a tar+bzip2 file?

Essentially, I'm hoping someone with an advanced knowledge of tar/bz2 can answer whether this is possible. The situation is that we have a periodic 24GB feed of data from a vendor, as a .tbz file. ...
3
votes
2answers
500 views

Search for a file inside a tar.gz file without extracting it and copy the result to another folder

I need to search for a file inside a tar.gz file without extracting it. After that, I need to copy the file that was searched (if ever there is) to another folder. So far I have this, but the copy ...
3
votes
3answers
803 views

How do I resume a tar command which was killed

I was doing a : tar -cvf and I had to killed it with ctrl-C. I know I should have done a Ctrl-Z and then bring back the task to foreground... but it's not the story. Can I resume from the point I ...
3
votes
1answer
3k views

Will tar -cvzf packed.tar.gz mydir take hidden files into account?

I need to create a tarball of a given directory. However, I need to make sure hidden files are included too (such as those beginning with .). Will the following command automatically take the hidden ...
3
votes
2answers
680 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 ...
3
votes
2answers
30 views

TAR: better to skip directory or use split

I've got a file.tar.gz that I create and backup to Amazon S3. It's gotten bigger than Amazon's limits and thus has not been backing up. This is my current command: tar -cpzf file.tar.gz directory/ ...
3
votes
1answer
169 views

How can I copy a file between server using bsdtar?

I'm looking for the fastest way of copying a file between 2 linux servers using bsdtar. With normal tar, I would do something like: ssh root@remote 'tar -cz -C /my/path/ big_file.txt' | tar -zxv ...
3
votes
2answers
1k views

Remove files from tar archive

I have a large file foo.tar.xz that contains a lot (say 200000) of files. I figured out that this archive contains some (around 5000) files I don't want. I don't have sufficient disk space to ...
3
votes
1answer
443 views

HP-UX 9: Backup filesystem using tar

So I've got an HP-UX 9 box that I'm trying to backup, first to a tape with fbackup, to no avail, and now to a folder shared over NFS. I'm using the command "tar -cvf /nfs/Results/backup.tar /" where ...
2
votes
4answers
80 views

What year did the Unix “tar” program get released?

Here's an simple question: what year did the Unix "tar" (TApe ARchive) come out? I wasn't able to find the answer with Internet searches.
2
votes
3answers
973 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 ...
2
votes
2answers
2k views

How to scp/tar files that are in between specific days?

I need to copy db log files between two suse servers where I am interested in files ONLY in between 10.3.2013 - 13.3.2013 It is desired to compress the files before copying so I tar them and scp. ...
2
votes
2answers
214 views

Create release version using tar

I have a project with the usual stuff (source code, yadda, yadda) and I want to have a command to Scons (but it could be whatever build system to be honest) that will do the following: Build the ...
2
votes
1answer
79 views

What characters TAR doesn't like?

I keep a list of photos burned to dvds for incremental backups but I got into a strange situation where a file was already burned into a dvd but tar keeps saying it's not. Here the steps to reproduce: ...
2
votes
2answers
2k views

How to install tar file (jhead) on Mac or Linux machine

I'm new to Linux and tar balls and was wondering how to properly install them on a Mac or Linux machine. I would prefer to know how to install on a mac but I just need some help understanding them. I ...
2
votes
1answer
545 views

Extracting / Installing a TAR file

When I extract a tar file using this command: tar xvzf gcc-4.7.1.tar.gz (This is the directory the tar file is in: cd /u/test/GCC-4.7.1/) The files were extracted but they are in /dev/... (see below ...
2
votes
1answer
77 views

tar and if-statement

I have a script that check if a file exist inside a tar file but something's wrong because it always go to the else part of the script. I am pretty sure that it shouldn't be that way. The date is in ...
2
votes
2answers
852 views

I need to transfer a very large folder over FTP, without creating a file first

I am running an Amazon EC2 instance that is limited in disk space. I have a very large folder that I need to FTP to my local machine, preferably without creating an intermediate tar file, since there ...
2
votes
2answers
4k 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 ...
2
votes
3answers
54 views

Tar compress folder without specifying the filename

Is it possible to use tar to compress a folder without giving the filename of the archive to store in? Normally you use: tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog I want to do something ...
2
votes
2answers
172 views

How to create a gnu tarball that can be extracted by solaris tar

I am maintaining a legacy cygwin (with GNU tar v1.21) system and a legacy Solaris 9 system. The configuration of the Solaris 9 system is fixed and cannot be upgraded (i.e. I can't install gnu tar for ...
2
votes
6answers
745 views

How to make tar globbing work with the 'change directory' option

I have the followin directory structure: base/ files/ archives/ scripts/ I want a script to run from scripts/, compress files that match results.*.log in files/ into a gzipped tar archive ...
2
votes
3answers
2k views

Use find and tar together

I have a directory with many log files, with filenames like acct.20111001 up to acct.20111030. I want to zip them by running: tar -cvjf acct.20111001.bz2 acct.20111001 How can I use find to ...
2
votes
2answers
63 views

How can I flatten nested .tar.gz files?

I've got a bunch of .tar.gz files in different paths. I'd like to create a new .tar.gz file at some common ancestor of them and I don't want it to be composed of nested .tar.gz files. How can I easily ...
2
votes
1answer
91 views

recover partially overwritten tape from tar -c

I have a situation. I was supposed to run tar -x to recover a tar file from a tape but I pressed "c" and forgot to put the tape on readonly. The file was on fsf position 23, but the tape had 27 files. ...
2
votes
1answer
73 views

Do tar archives include user/group name by default?

In tar's man page I stumbled upon two options: --numeric-owner: always use numbers for user/group names --owner=NAME: force NAME as owner for added files This made me wonder: When I tar ...
2
votes
2answers
4k views

How to extract specific file(s) from tar.gz

How can we extract specific files from a large tar.gz file? I found the process of extracting files from a tar in Untar only a certain number of files from a large tarball but, when i tried the ...
2
votes
2answers
267 views

Untar directory from large tarball

How do I untar a directory that I don't know the path to? I only know the directory name. I know how to untar a single file with a wildcard: tar -xf somefile.tar.gz --wildcards --no-anchored ...
2
votes
2answers
33 views

Is it possible to generate a separate file list when creating a tarball?

When using tar for backups I'd like to create a separate list of the files that is included in the archive for storing alongside the backup tarball. Solutions that's not so good: tar --verbose ... ...
2
votes
2answers
475 views

Verifying a .tar.gz backup

Edit 3: For people who will read this question: --verify mysteriously fails with "Warning: Cannot seek: Illegal seek", hence I recommend you look for alternative ways to verify your archives. My ...
2
votes
1answer
503 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 ...
2
votes
1answer
47 views

Does * match hidden files in tar even with dotglob unset?

I was under the impression that the * glob does not match dot-prefixed files unless you manually enable such functionality (through dotglob, or your shell's equivalent). Yet if I have a directory a ...
2
votes
1answer
88 views

tar.bz2 7zip selective extract prformance

We use tar.bz2 as our archive of server logs. We also write tools that selectively parse these archived logs. Many times I must regex-search one file’s lines in the archive to determine if other ...
2
votes
1answer
179 views

How to compare two tar archives (including file content, new/removed files, symlinks)?

I have two tar archives (compressed or not compressed), and I want to find all differences in the two archives. Both archives contain a complete file system (i.e. when unpacked, would generate ...
2
votes
1answer
117 views

Tar ignore or fix checksum

I have a archive backup.tar that was created with a nonstandard program a long time ago. I no longer have access to the original program. The archive is Not compressed (gzip). When trying to extract ...
2
votes
1answer
222 views

Issues while untaring tarball with acl

I am getting an error “Unknown file type 'A', extracted as normal file” while un-taring a set of files which has acl permissions set. I had created the tar file in Solaris with tar -cpfv ...
2
votes
0answers
269 views

How to fix the corruption of the tar balls?

I was making a complete server backup and tried making the tar balls of each directory structure by using the following commands: nohup tar -cvf - /etc | gzip -9 -c > /opt/Backup_4_Jan/etc.tgz ...
1
vote
1answer
386 views

Using tar on a file with an @ (at symbol)

I'm trying to extract a tarball using tar -xvf that's in the format (where * is any word character) *@*@*@*.tar.gz but I think tar is trying to find the file at a remote location. The error I get is ...
1
vote
2answers
2k 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 ...
1
vote
2answers
57 views

Download the file from either of two machines using SCP?

I have a below bash shell script which I am running from machineA and that shell script will try to download a tar file from either of these two machines machineB and machineC and put it in ...
1
vote
6answers
442 views

How to avoid overwriting existing files while using tar command?

The tar command just overwrote my file an hour ago while I was trying to make a tar to backup it. I ran tar zcvf foo.tex foo.bib and after that my tex source file lost. What's worse, this is the ...
1
vote
1answer
1k 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 ...
1
vote
1answer
3k views

Create target directory when extracting tarball

Is it possible to create a target directory, similar in nature to the mkdir -p switch, where I can define a non-existent target directory within my tar command, and tar will create the directory for ...