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

learn more… | top users | synonyms

1
vote
2answers
95 views

How do I pipe the files downloaded with wget through tar?

I would like to pipe tarballs (.tar.gz files in this case) I download with GNU Wget (wget) through tar -xzf (to decompress them, if this is unclear) but I don't know how. I have tried: wget -q -O- ...
3
votes
2answers
4k 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 ...
14
votes
2answers
586 views

Does parameter order matter with tar? [duplicate]

I am learning Linux. I was surprised to see that the parameter order seems to matter when making a tarball. tar -cfvz casual.tar.gz snapback.txt bucket.txt gives the error: tar: casual.tar.gz: ...
0
votes
1answer
229 views

bash: /usr/bin/find: Argument list too long

I have too many files in a folder. I just want my inodes to be get free as soon as possible,So I have tried with find ./EcoBackup/* -name '*.*' > FilesBackupName.txt bash: /usr/bin/find: Argument ...
1
vote
1answer
79 views

What are the relative merits of the various standard Unix archival utilities? [closed]

There are many archival tools for Unix, with varying degrees of availability. To make matters more confusing, many of them can write each other's formats. I am seeking more information on their ...
0
votes
1answer
48 views

Encrypting existing tar.gz archive

I know of a method to encrypt a tar.gz archive while creating it (not sure if it's a recommend one): tar -czvf /path/to/save/archive.tar.gz -C /path/to/archive . | openssl des3 -salt -k #PASSWORD# | ...
0
votes
0answers
38 views

repack of fix tar file (containing files with similar name) with unexpected EOF

I have tar file, which is a backup from my Android 5.0 phone. The issue is that I get an unexpected EOF error. I wish to repack it. There are also several files with the same name (but different size ...
4
votes
2answers
53 views

Resumable archive

I've a need to archive some big directory structures on an NFS server. They're not likely to be needed particularly soon, if ever - they're just being retained for policy reasons. To this end, I'm ...
1
vote
2answers
34 views

Is it necessary to transfer `tar` files through `rsync` in archive mode?

I have a bunch of tar files in my machine which I want to transfer to an external hard drive (EHD); they where created preserving permissions (using the -p flag). I plan to use rsync to copy them to ...
3
votes
2answers
74 views

create flat tar archive: ignoring all parents when adding folders

I want to add a few folders (recursively) to a new tar archive. All of the folders should be at the root level of the resulting archive. Is there any way to add all folders without their parents, and ...
2
votes
1answer
752 views

Why I can't unpack .tar.bz2 or .tar.xz files?

I'm having a problem unpacking files when I try to build from source on my OpenBSD First I thought it was just corrupted files but after it happened to many different programs and from different ...
8
votes
2answers
8k 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 ...
1
vote
1answer
33 views

`sudo tar` but own the resulting file

I want to put a bunch of files into an archive with tar. However, I don't have permission to access all of them, so I have to do sudo tar. However, now that root has run the tar, the resulting ...
2
votes
0answers
60 views

Backup using find and ssh to off-site server

I'm sure this has been been answered in bits and pieces on many sites, but somehow I can't seem to get this (as a whole) to work reliably. Scenario: I have a server that I would like to do ...
0
votes
2answers
48 views

I am trying for a tar call and getting the below error

I am trying to use tar and get the following error: $ tar --strip-components=1 xf /data/rvm-latest.tar.gz  tar: You must specify one of the `-Acdtrux' or `--test-label' options Try `tar --help' or ...
-1
votes
1answer
52 views

Linux backup a folder by each

I have a folder /home/software, with some sub folders /home/software/game /home/software/photo /home/software/ebook ... I want to create tar backup including the date for each sub-folder so I will ...
16
votes
4answers
2k views

tar and its key letters: is it a bug or feature?

I am wondering to ask the difference of these two commands (i.e. only the order of their options are different): tar -zxvf foo.tar.gz tar -zfxv foo.tar.gz The first one ran perfectly but the ...
0
votes
1answer
43 views

How to recover a .tar backup

I've a .tar backup, when I try to extract using below command. tar -xvf backup.tar Nothing is extracting and no errors or warning Seems like its corrupted. Is there any way to recover the .tar ...
1
vote
2answers
47 views

Remove Specific File From Tar Archival Process After the Process Starts

When tar-ing up large directories (ie. a home folder for a backup/OS reinstall), it is often okay to exclude certain large files such as multi-GB videos. However, due to the all-encompassing nature of ...
4
votes
2answers
48 views

Tar is currently reading a 2GB file, and I deleted its only link. How do I stop it from running for an eternity?

Some more information: I was backing up a large directory with tar, only there were a couple of large files there that I didn't expect. This connection is over the network and very slow, so simply ...
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 ...
0
votes
1answer
69 views

change tape on the fly script

I have to write 17 Tb to tape: ssh some_host 'tar -cz /' | dd bs=20b of=/dev/tape of course 17 Tb doesn't fit to one tape so I need automatically change it when "no room" error occurs. I have ...
2
votes
3answers
220 views

tar unix not changing directory

I am executing a tar command to compress files which are present in another directory. I executed following command: tar -czf /backupmnt/abc.tar.gz -C /backupmnt/statusService/ * I want to create ...
0
votes
1answer
52 views

Store restored files and directories in a separate directory

I have backup files in the form backup-date.tar and these files will be in a directory called backup. I am performing a restore by using tar -xvf backup-date.tar but the restored file is placed in the ...
0
votes
1answer
30 views

Tar archive list in a bash script

I have a function bound to an alias for easy listing of archives. function list-tar-archive { if [ "X$1" != 'X' ]; then out=tar -tf $1 | awk -F/ '{if (NF<3) print }' echo ${out} fi } ...
0
votes
0answers
21 views

Extract tar archive ignoring the Archive file name in single command [duplicate]

I would like to extract a tar file archive.tar.gz into a directory /Users/guest/data without the creation of the archive directory in the data directory tar -xvf archive.tar.gz -C /Users/guest/data ...
6
votes
3answers
2k 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.
0
votes
3answers
215 views

shell script to backup files in a specified directory

tar -czvf /var/local/mybackup.tar.gz -C /etc/alternatives/ I used the above mentioned code to create a backup file. But it is showing me this error. tar: Cowardly refusing to create an empty ...
5
votes
1answer
273 views

Untar filenames in a character encoding different from encoding used in the filesystem

I occasionally get tarballs where the filenames are encoded in ISO-8859-1 or some other pre-Unicode scheme. My system uses UTF-8, so when I untar these archives with the usual options (tar xvf ...
4
votes
2answers
60 views

How to untar a file skipping the beginning of the directory structure?

I created tar archives with an absolute path to save the files. /home/mydir/dir1/dir2/dir3/file1.dat /home/mydir/dir1/dir2/dir3/file2.dat /home/mydir/dir1/dir2/dir3/file3.dat I would like to untar ...
-1
votes
2answers
152 views

take tar and copy to remote server and extract that tar

I want to take tar from a logged in shell and take that tar file to a remote host and then extract the tar file over there. I've got below command but the tar itself is not creating. time=`date` ...
17
votes
3answers
20k views

tar cvf or tar -cvf ?

I have learned to use tar without '-' for options, like tar cvfz dir.tar.gz Directory/ but I recently came accross the slightly different tar -czvf syntax (I think the 'f' must be the last option in ...
1
vote
1answer
64 views

curl progress in dialog

how can i properly display the curl progress in the dialog window? curl http://mysite.corp/image/root_21.tar.bz2 | tar -C /mnt/dest/ -jxf - i tried this command but as you can see it does not ...
10
votes
3answers
6k views

creating archive using tar including all 'dotfiles' but excluding all subdirectories and /wo directory structure

I want to backup all the 'dotfiles' (f.e. .zshrc) under my home directory with tar, but excluding the directory structure and all subdirectories. I've tried it several times with different commands, ...
0
votes
1answer
56 views

How to exclude directories from tar in this script?

Answering my own question yesterday, I wrote a bash script which archives all directories within a defined directory into their own separate archive files. I have also defined a variable for a file ...
3
votes
2answers
139 views

Why does tar hang with 100% CPU if files list has leading spaces

Tar hangs with 100 % CPU load if the --files-from <LISTFILE> option is used and the <LISTFILE> contains leading spaces. Why is that? To reproduce: Given two files file1 and file2 of ...
1
vote
2answers
138 views

Performance of `tar -xf` (block size related)

I'm recently working on optimizing the performance of tar -xf, i.e. untar a file. I notice that under default settings, tar -xf calls writes to write 10 KiB output at a time in chunks. However, this ...
2
votes
1answer
148 views

Recover corrupt tarball

I have a corrupt tarball on my hands. My first attempt at recovery went like this: $ tar --ignore-failed-read --ignore-command-error -xf tarball.tar tar: Skipping to next header tar: Archive contains ...
0
votes
4answers
97 views

How to delete files from a directory based on the contents of a gzipped tar file?

Given that I: have a directory that contains over 1000 files have a gzip'ed tar file that contains a subset of those files (x.tgz) What is the single command line (if it is possible) that will ...
0
votes
2answers
122 views

How do I archive a folder keeping owners and permissions intact?

Is there any way to archive a folder and keep the owners and permissions intact? I'm doing a backup of some files, which I want to move using a usb-stick, which has a FAT filesystem. So the idea was ...
0
votes
1answer
51 views

How to ignore adding modified time to archive file while compress using tar

Can we instruct tar to do not keep modified time of the files in archive file while compress. What I want is, the extracted directories/files should get time from machine where it's extracting, not ...
0
votes
1answer
47 views

exclude files in tar.gz

I want to exclude two files from a tar file.. But it doesn't seem to work cd /var/www/public/api_test tar -zcvf api_v2.x.tar.gz api --exclude "./api/distributor_test.php" --exclude ...
-2
votes
2answers
87 views

What is the default path of newly created tar archive?

I created tar archive using following command: tar -zcvf archive-name.tar.gz directory-name After this operation, where that tar.gz is located?
3
votes
2answers
1k views

tar command - skip symlinks

I use the tar command as, tar -cvf protTests.tar protTests/* to tar all files inside the folder, protTests. But this is including the symbolic links inside the folder, which is not a desired one. ...
25
votes
2answers
36k views

scp and compress at the same time, no intermediate save

What is the canonical way to: scp a file to a remote location compress the file in transit (tar or not, single file or whole folder, 7za or something else even more efficient) do the above without ...
4
votes
2answers
13k views

Create target directory when extracting tarball

Is it possible to create a target directory, similar to mkdir -p, where I can define a non-existent target directory within my tar command, and tar will create the directory for me? I know I can ...
8
votes
4answers
221 views

How can I filter the contents of a tar file, producing another tar file in the pipe?

Consider a single tar file from an external system which contains some directories with various attributes which I want to retain such as permissions, mtimes, etc. How can I easily take a subset of ...
4
votes
1answer
137 views

Install powernap on debian?

I just read about powernap here but don't know how to install it.. Download and untar was simple: axel https://launchpad.net/powernap/trunk/2.20/+download/powernap_2.20.orig.tar.gz && tar ...
3
votes
2answers
815 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 ...
6
votes
2answers
435 views

How to use tar to compress a group of files in a .txt file?

I have a lot of filenames that listed in a .txt file called to_be_archived_files.txt, and its content is as: ~/Documents/dir1/a.html ~/Documents/dir1/b.html ~/Documents/dir1/c/1.html How do I add ...