Skip to main content

Questions tagged [tar]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
924 views

How do you determine the remaning capacity of a magnetic tape with mt or tar? How much space is in a block?

I am currently trying to back up data onto an LTO-4 tape using mt-st and gnu tar 1.32, but I want to make sure I stop trying to copy things before the tape runs out! LTO-4 nominally has a capacity of ...
1 vote
1 answer
3k views

Can tar verify integrity of untarred files on destination disk?

Example: I create a.tar.gz from the file "a.txt" (so I used the -z option). Let's say the checksum of the file a.txt before it's added to the archive is "abc123". When I untar and "a.txt" is written ...
3 votes
3 answers
2k 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 ...
13 votes
5 answers
42k views

How to make tar save the archive on a remote machine using sftp or ftp?

I would like to backup some of my very important data on a remote machine. Currently I'm just saving it to my local machine by using this command: tar -cvjf ~/backups/Backup.tar.bz2 ~/importantfiles/* ...
3 votes
1 answer
2k views

With bsdtar "--exclude", how to only exclude subdirectories?

In GNU tar (i.e. gtar), the --exclude option with a glob only matches the subdirectories, but not the directory itself. For example, --exclude test-tar/a/b/* would exclude anything inside of b, but ...
29 votes
3 answers
58k views

How to use multi-threading for creating and extracting tar.xz

I use tar -cJvf resultfile.tar.xz files_to_compress to create tar.xz and tar -xzvf resultfile.tar.xz to extract the archive in current directory. How to use multi threading in both cases? I don't ...
3 votes
2 answers
521 views

Get GNU tar PID inside of --to-command

We have this GNU tar command as shown: $ tar -xjf /dev/st0 --to-command='sh -c '\''printf "%s\n" "$TAR_SIZE $TAR_REALNAME" >> "$TAR_ARCHIVE.sizes.txt"'\' Is there ...
1 vote
2 answers
590 views

Cheating tar out of "Cannot change mode to rwxrwxrwx: No such file or directory"?

I'm trying to build GCC 10, and in the end, I get a failure in make install (I'm trying to run sudo checkinstall -D --install=no --fstrans=no instead of make install, though, so I can build a .deb ...
0 votes
0 answers
56 views

Removing leading `/' from member names error: open .: is a directory

when I tried to copy files from remote kubernetes pod to local machine: ➜ ~ kubectl --kubeconfig=/Users/xiaoqiangjiang/.kube/admin.conf cp reddwarf-pro/texhub-server-service-675bffc7c5-ws2n5:/app/...
0 votes
0 answers
45 views

Verify sha256sums of files inside tarball using hashfile

Is it possible to check the tarball's files sha256sums without first extracting to disk? I have this file: $ cat cathy.sha256 \SHA256 (atypical\nfilename) = ...
0 votes
1 answer
41 views

tar returning different exit code when wrapped inside if statement [duplicate]

I have a script which creates a tar archive filtered through xz. I have wrapped the tar command inside an if statement so the script can take different actions depending on whether the archive was ...
1 vote
2 answers
53 views

tar not excluding symlinked directories

Tar version: root@node: /tmp > tar --version bsdtar 3.4.2 - libarchive 3.4.2 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 I have a directory structure which looks like this: root@node: /tmp > ls -...
0 votes
1 answer
2k views

gpgtar: encrypted packet with unknown version

I'm getting the error in the title (aead encrypted packet with unknown version 29), when trying to decrypt an encrypted file created in the same environment (Termux on Android, if it matters): $ ...
1 vote
1 answer
2k views

Can I extract an overwriting tar archive, while retaining the ownership of the original destination file(s)?

I have a particular use case, where I want to extract a tar archive (as root) and intentionally overwrite some destination file(s) with the contents of the archive. This is all fine and easily ...
0 votes
0 answers
16 views

What does df actually display? [duplicate]

Today I was using tar to backup the /var directory of my server. At some point, I noticed that this is taking very long, so I used du to figure out how large /var is. It was about 76 GB. My disk had ...
0 votes
2 answers
79 views

tar: ./.tar.gz: file changed as we read it | "Flagged" files are unrelated to the file tar is supposed to operate on

I am trying to use tar to recursively compress all files with the .lammpstrj extension within the directory tree starting at the directory whose path is stored in the variable home. home contains the ...
0 votes
3 answers
96 views

Program which archives "files" from stdin to stdout, without hitting the disk?

Can anyone suggest a program which: Creates some form of archive from stdin, out to stdout, with filenames, and without hitting the disk (the data is sensitive) The program output will eventually be ...
4 votes
3 answers
3k views

How to determine size of tar archive without creating it?

I'm archiving a few directories every night to LTO-7 tape with about 100 or so large (2GB) files in each of them. As a check that the data has been written correctly, I'm verifying that the number of ...
37 votes
2 answers
8k views

Why is tar archive so much bigger than text file, 10240 bytes?

I've checked these two questions (question one, question two), but they were not helpful for me to understand. I have a file file.txt with 40 lines of Hello World! string. ls -l shows that its size is ...
16 votes
7 answers
13k 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 ...
16 votes
4 answers
63k 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*
0 votes
1 answer
61 views

when tar creates a huge tar file that does not make sense

On RHEL 7-9, on a seemingly good system, with the XFS file system on the root partition, I am trying to cd /var tar -cf log.tar log a du -sh /var/log shows 173M however the tar process will take 10+ ...
-1 votes
1 answer
44 views

How to untar with excluding one top level folder

I want to exclude the ".git" from untar, but without success. Here is the folder structure: mkdir -p /tmp/test mkdir -p /tmp/test/.git/hi touch /tmp/test/.git/foo.bar touch /tmp/test/....
-2 votes
1 answer
58 views

Need Help on How to Uninstall .tar.bz2 file in fedora

I installed wingpro-10.0.3.0-linux-x64.tar.bz2 several days ago. Could you please teach me how to uninstall the application since yum remove or dnf remove don't work on tar.bz2 type file. Appreciated ...
0 votes
0 answers
50 views

This does not look like a tar archive, A lone zero block a at 24

I performed this C:\Users\User> adb exec-out "cd /storage/sdcard1 && tar c * -" > extsdcard.tar The file returned this: User@LAPTOP-DJH6CVKH MINGW64 /a/realme 5/sdcard $ file ...
260 votes
7 answers
474k 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 this question but, when I tried the mentioned command there, I got the error: $ tar --...
2 votes
1 answer
189 views

Tar new volume script fails with "Syntax error: Bad fd number"

My shell script (see below) is failing partway through execution with "/bin/sh: 1: Syntax error: Bad fd number." This thread suggests that the problem is using the >& construction in ...
21 votes
6 answers
12k views

Faster alternative to ArchiveMount?

At the moment I am using ArchiveMount to mount a 123,000 kb archive that contains more then 3 million files inside. So far it has been mounting for 5+ hours and still isn't finished. Is there a ...
27 votes
4 answers
52k views

Force the owner and group for the contents of a tar file?

I would like to create a tar file with contents belonging to an owner:group pair who do not exist on the system from which the file is being made. Here's the direction I've tried: tar ca --owner='...
-3 votes
1 answer
212 views

tar: Exiting with failure status due to previous errors

I running $ cat /etc/*-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=...
0 votes
1 answer
8k views

"gzip: stdin: invalid compressed data--format violated" error when extracting a tgz archive

I have to open a tar file. I used the following command line on my Unix shell: tar xfvz raw-GWA-data.tgz I found the following error message: gzip: stdin: invalid compressed data--format violated tar:...
0 votes
2 answers
42 views

container options from linux other than tar that work in Windows

I have Windows 10 pc's that do not have winzip or 7zip, or any kind of compression software installed. do not ask why As such the windows10 pc's can only do an unzip. They are unable to work with a ....
0 votes
2 answers
149 views

tar says Cannot open: No space left on device but df -h and df -i both show the available space is very large

I have around one hundred .tar files and they include millions of small files. I want to extract them to one directory in Linux. These .tar files are on a mounted LVM EXT4 file system. But no matter I ...
3 votes
1 answer
70 views

Why is Tar speed not same?

I heard somewhere on the Internet that cpio is faster than tar. So I tried to check it with my shell script. #1/bin/bash rm ct.tar ct.cpio sync && sudo sh -c "/usr/bin/echo 3 > /proc/...
0 votes
1 answer
3k views

How do I extract a .tar.xz file?

Some software seems to be distributed in a new archive format: $ file node-v18.7.0-linux-x64.tar.xz node-v18.7.0-linux-x64.tar.xz: XZ compressed data How do I extract this, preferably using tar (like ...
19 votes
3 answers
36k views

Create a tar archive of the current directory without preceding period

When I do the following: tar czvf ../myarchive.tar.gz ./ I get a single (annoying) root folder in my tar archive: How do I remove this awful period when creating the archive?
0 votes
1 answer
53 views

Archiving stdout to multiple tapes

I have large files which are generated on the fly to stdout, one every 24hours. I would like to archive these files progressively on tapes, ideally in a single archive which potentially spans multiple ...
59 votes
1 answer
58k views

ansible extract without first directory

When extracting a tar.gz file in ansible I end up with a first directory - name: Extract archive unarchive: src=file.tar.gz dest=/foo/bar which results in /foo/bar/bar-version-...
1 vote
1 answer
117 views

GNU tar how to preserve file immutable attribute set by "chattr +i" in Linux?

I want use tar(GNU tar 1.30) to backup files with immutable attribute set by "chattr +i" in Linux. Command lines below: mdx@e5450:~$ touch test.txt mdx@e5450:~$ sudo chattr +i test.txt mdx@...
4 votes
2 answers
499 views

Untar files from a huge tarball, but only created between two timestamps

I would like to untar only that files created between 2024-02-19 01:00:00 and 2024-02-19 02:00:00 from a huge tarball. I don't know how should I combine the tar and the find commands, because I can't ...
3 votes
3 answers
1k views

Non recursive tar listing

I have a tar archive file containing a directory with lots of files and I desire to list just that directory without extracting it (to hastenly know that directory's filename). I executed: tar -tf ...
11 votes
3 answers
8k views

Can `tar --list -v` list file size in human-readable format?

I want to list members of tar files verbosely, and show the file size in human-readable format not in bytes, does the tar has the option to do this?
-1 votes
2 answers
108 views

RHEL + backup huge partition over network to local folder

We want to perform backup of /DB_TABLES from remote server to our local /bck ssh root@main_server "tar cfz - /DB_TABLES" |tar xz -C /bck Since /DB_TABLES partition on remote server is 1.4T, ...
36 votes
1 answer
69k 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 ...
1 vote
1 answer
1k views

Compressing an archive of images does not reduce its size significantly

I have lots of pictures to back up from my computer to an external hard drive. I want to make archives of all picture folders I want to back up and compress them to save space on my external drive. I ...
49 votes
7 answers
111k views

How to solve “tar: invalid magic” error on Linux Alpine

I'm installing sqlite on Alpine Linux. I download sqlite-autoconf-3130000.tar.gz but tar could not open it. I tried this answer but it's not working. tar gives this message: tar: invalid magic tar: ...
1 vote
2 answers
136 views

Looking for a tool that creates plain text tarball from set of files, they can be mailed in email body

I'm looking for a command line tool that takes a tarball, uncompresses and unpacks it, and turns the contents into one contiguous file, comprised of lines that are a maximum of eighty characters wide, ...
0 votes
1 answer
84 views

Why does GNU tar's --dereference option not cause it to dereference symlinks?

I thought I knew how GNU tar -h (aka --dereference) worked, but now I am confused. Consider: $ tree dir/ dir/ ├── file └── link -> file 1 directory, 2 files If I add -h to my tar command, shouldn'...
19 votes
5 answers
9k 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 ...
207 votes
5 answers
182k views

How to choose directory name during untarring

Say I have a file named ugly_name.tar, which when extracted, becomes ugly_name directory. What command can I use so that the resulting directory name is pretty_name instead?

1
2 3 4 5
26