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

learn more… | top users | synonyms

2
votes
2answers
7k views

Compress old log file into single zip-linux

I have a folder /home/testuser/log which contain log files of one day old *.log. I wish to compress all the log files older than one day to a single zip(gzip or tar.gz) and delete the older files. I ...
3
votes
3answers
455 views

Different count for compressed file listing vs directory listing

I was taking a backup of a folder, where I used the following command : sudo tar -zcvf www.tar.gz /var/www/ It successfully compressed, just for verifying the number of files in the compressed ...
5
votes
3answers
1k 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 ...
1
vote
1answer
240 views

tar -c Error Messages and Source Files?

During a tar archiving operation with tar -cvf archive.tar source does the resulting tar archive that reports a file changed as we read it error still contain "some version" of the source file that it ...
4
votes
1answer
777 views

Does tar -x Extract to Current Directory or Does it Extract to the Source of the Archive?

Does tar -x by default just extract to the current directory or does it try to reproduce the original directory structure including overwriting the original source? I know I can specify a folder to ...
3
votes
1answer
2k views

Extrat tar “Cannot open: File name too long”

I made a tar with a directory on a remote machine with: tar -czvf I scp it to my local machine, where I wanted to untar it: tar -xzvf But I get : Cannot open: File name too long On my local ...
3
votes
3answers
483 views

Tar a file with a different name

To make my environment deployable, I occasionally tar up some handy files and scripts: tar -czvf env.tgz .vimrc .vim/ bin/lsl bin/s I would like to add .bashrc to the mix, but I have some sensitive ...
1
vote
2answers
4k views

tar: Unexpected EOF in archive

I am trying extract .tar.gz file it but with no luck gzip: stdin: unexpected end of file tar: Unexpected EOF in archive tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now the ...
3
votes
1answer
169 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 ...
2
votes
1answer
270 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 ...
3
votes
1answer
436 views

“tar --exclude-backups” does not exclude files with tilde at end

If I have the following directory: $ ls -a foo . .. a #a# a~ b b.bkp c .git .hg .svn and call: $ tar zcf foo-no-bkp.tar.gz --exclude-backups foo/ The resulting archive still has backup ...
3
votes
1answer
421 views

tar: exclude gzip file, and don't try to gunzip it

I would like to skip a large gzip file when I extract a tar file, but everytime tar starts to gunzip it to look inside it seems. Even when I just try to peek inside tar seems to start gunzipping it, ...
6
votes
3answers
448 views

How to convert tar file from gnu format to pax format

On the one hand I have a lot of tar files created with gnu format, and on the other hand I have a tool that only supports pax (aka posix) format. I am looking for an easy way to convert the existing ...
3
votes
1answer
381 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 ...
5
votes
2answers
29k views

Compress a folder with tar?

I'm trying to compress a folder (/var/www/) to ~/www_backups/$time.tar where $time is the current date. This is what I have: cd /var/www && sudo tar -czf ~/www_backups $time" I am ...
1
vote
1answer
367 views

Recover corrupted .tar salvaged from Android

I had an android phone that developed a fault in which it only persistently showed the boot logo. I sent it for Samsung for repair, who send it to a third-party company to be repaired. I was told that ...
4
votes
3answers
11k views

How to copy between two remote hosts using tar piped into SSH from remote server when behind a firewall?

I'd like to transfer a directory between two servers, but compress the directory on the remote host before transfer, and then uncompress to another host. I'm sure it's possible to pipe everything all ...
2
votes
1answer
651 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 ...
18
votes
2answers
877 views

What does .??* mean in a shell command?

The following command will tar all "dot" files and folders: tar -zcvf dotfiles.tar.gz .??* I am familiar with regular expressions, but I don't understand how to interpret .??*. I executed ls .??* ...
9
votes
2answers
1k views

Dereferencing hard links

In the manual page of tar command, an option for following hard links is listed. -h, --dereference follow symlinks; archive and dump the files they point to --hard-dereference follow ...
4
votes
2answers
740 views

Find recursively all archive files of diverse archive formats and search them for file name patterns

At best I would like to have a call like this: $searchtool /path/to/search/ -contained-file-name "*vacation*jpg" ... so that this tool does a recursive scan of the given path takes all files with ...
7
votes
3answers
2k views

Untar only a certain number of files from a large tarball

I have a large tarball that is busy being FTP'd over from a remote system to our local system. I want to know if it is possible to start untarring lets say 50 files at a time so that those files can ...
0
votes
3answers
501 views

Zip file using tar on linux server

I'm trying to make a zip file out of some files but when I extract the zip I only get 1 file. tar cfvz test.zip file1.mp3 file2.mp3 file3.jpg And after I extract test.zip I only get a "test" ...
3
votes
2answers
729 views

I want to tar X directory not including its parents

tar cvf /var/lib/backup/sample.tar /home/user/.project However, when I extract, I get its parents as well /backup/ - /home/ - /user/ - .project/ This tar commands does it job ...
5
votes
4answers
4k views

Preventing tar from using too much CPU and disk (old laptop crashes if 100%)

I want to backup 1 terabyte of data to an external disk. I am using this command: tar cf /media/MYDISK/backup.tar mydata PROBLEM: My poor laptop freezes and crashes whenever I use 100% CPU or 100% ...
4
votes
3answers
2k views

Why does tar --exclude=“.*” create an empty archive?

Everything I read says that to exclude .svn and .htaccess and other hidden files when creating a tar archive, use the --exclude=".*" pattern. When I try, I get an empty archive. When I leave out the ...
5
votes
2answers
3k views

If I change permissions on a tar file, will that apply to the files inside it?

I have a script that runs regularly via cron, that creates a tar.gz file for the purpose of backing up a directory. For reasons beyond my control, the only user who can execute the script via cron is ...
8
votes
1answer
5k views

How to check/test .tar.bz archives?

I've been using tar with its "--use-compress-prog=pbzip2" function to archive my files then compress them with pbzip2 to get an "*.tar.bz" archive. Afterwards I checked the resulting file with ...
2
votes
2answers
287 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 ...
4
votes
3answers
224 views

Indexed archive format?

I need to create compressed archives of files, and be able to quickly extract individual files/directories from them. The problem is, for example, tar.bz2 seems to be not the best choice for such ...
18
votes
1answer
18k views

How do you extract a single folder from a large tar.gz archive?

I am using this command on a 5GB archive tar -zxvf archive.tar.gz /folder/in/archive is this the correct way to do this? It seems to be taking forever with no command line output...
3
votes
1answer
508 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 ...
1
vote
1answer
181 views

rpm and deb fileformat are blocked by my ISP. How to install software?

I have a very peculiar problem, Just be patient with what I am saying and then see what all suggestion you can give me. I have situation where my ISP has blocked .rpm and .deb files to be downloaded. ...
3
votes
2answers
8k views

find a file within a tar.gz archive

Is it possible to use the find command so that it searches the files within a tar.gz archive also using wildcards? like find archive.tar.gz --name *foo*
2
votes
2answers
226 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 ...
3
votes
2answers
2k 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 ...
20
votes
6answers
34k views

tar --exclude doesn't exclude. Why?

I have this very simple line in a bash script which executes successfully (i.e. producing the _data.tar file), except that it doesn't exclude the sub-directories it is told exclude via the --exclude ...
8
votes
2answers
6k views

How to create backup from symbolic links?

I have a directory with symbolic links to other directories. I want to archive the symbolic links, not as links but as archives containing the files of directories they refer to, using tar command. ...
1
vote
1answer
422 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 ...
3
votes
5answers
700 views

How do I extract all .htaccess files from a tarball?

I want to extract all .htaccess files from a tarball, how can I do so? I see only one mention of "include" in the manual page of tar which is not related with an option for including only certain ...
4
votes
2answers
2k views

Why doesn't tar ask before overwriting existing files?

I lost a couple hundred lines of a Vim plugin I wrote and continue back up every so often because I extracted a tar file containing an older version. I decided not to use source control management ...
0
votes
0answers
48 views

Backing up to DVD [duplicate]

Possible Duplicate: Splitting large directory tree into specified-size chunks? I have a partition that is about 14G and I need to back it up to DVD in such a way that I can use each disc to ...
5
votes
1answer
2k views

Cannot open: Input/output error with tar command in a shell script

I am trying to create a tar ball in a shell script (I have enabled set -x), but I get an error: + cd /home5/mysite/public_html + TAR_DUMP=gypo_2012-02-18-03:51:15.tar.gz + echo 'Tar name: ...
4
votes
1answer
4k 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 ...
4
votes
2answers
1k views

Using files that have spaces in their name in pipes

I have folder named play which contains a file damn file (with space). When I use find and pipe the output to tar: find play/ -name 'damn*' | tar cf archive.tar -T - It works perfectly. Why does ...
11
votes
6answers
9k views

tar + rsync + untar. Any speed benefit over just rsync?

I often find myself sending folders with 10K - 100K of files to a remote machine (within the same network on-campus). I was just wondering if there are reasons to believe that, tar + rsync + ...
5
votes
3answers
1k views

Look at the tar log contents without extracting them

tar -tvf file.tar contains log files. Is there anyway to do something like this tar -tvf file.tar | head -1 | awk '{print $NF}' | xargs less {} This would give file not found, but is there a way? ...
4
votes
4answers
618 views

How can I move the entire OS to a different server?

I want to install RhodeCode on a test server at work. However, the internet access is restricted for that server, and RhodeCode has a lot of dependencies (I don't even have Python on that server). So ...
7
votes
5answers
2k views

force copying a corrupted home directory

I have a home directory in a disk that has a lot of corrupted files. I am trying to save most files as possible. I am trying to create a backup of my home directory on an external drive using tar ...
26
votes
5answers
16k views

How to XZ a directory with TAR using maximum compression?

So I need to compress a directory with max compression. How can I do it with xz? I mean I will need tar too because I can't compress a directory with only xz. Is there a oneliner to produce e.g. ...