Questions tagged [tar]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
8 views

Make Tar from Snapshot of Changing Folder (Btrfs?)

I have BTRFS on my Ubuntu server, and I’m using PostgreSQL as a database. I’d like to make a .tar.gz archive from the current state of the database folder. However, since the database is of course ...
1 vote
1 answer
30 views

Sequentially extract files from a tar.gz file

I have a large tar.gz file with 122000 files that I'm downloading from the web to a compute resource that is limited to 14GB. The tar.gz is 3.3GB and the fully extracted archive is 29GB. I know I can ...
0 votes
3 answers
48 views

save tar stdout to files using pipelines

I try to download a archive to a remote computer using SSH and also extract the archive on the remote client due to it having better performance. I have a very simple script that downloads the archive ...
  • 111
1 vote
0 answers
61 views

Does the tar format support checksums?

TLDR, my main questions: Does the tar format itself support checksums? How to create a tar (or even better, tar.gz file) with the tar format built-in checksum? Long: Before you ask why I am asking or ...
  • 1,629
0 votes
1 answer
18 views

Tar Copy while skipping over a certain file pattern

Goal: I am trying to create a command that copies all files except for any files that start with "." or "._" BTW I am using Arch Linux 5.19 with ZSH Scenario: I have a nearly full ...
1 vote
1 answer
23 views

Backup website files using SSH and WGET - omit /path/to/htdocs in resulting tar

After SSH into remote webserver, I execute the following command on CentOS remote web server: tar -vcf remote_name.tar /home/remote_name/public_html On my local sys (Debian based), I execute the ...
  • 13
1 vote
2 answers
34 views

order of (GNU) tar arguments under old style syntax?

In a shell pipeline, I compose a tar archive from a selection of files under a directory, taking the list of files from stdin, and write the archive to stdout. When I run tar like this: tar cCTf ...
  • 150
0 votes
0 answers
23 views

Is there a fast command like tar --remove-files that leaves file chunks in place?

I create hundreds of thousands of files, each several megabytes, resulting in directories (and subdirectories) containing a TB or more. To move the data to another drive, 'cp' tends to slow down over ...
1 vote
1 answer
30 views

How to extract all uncorrupted file from bzip2 compression?

I am trying to uncompresss a bzip2 file (~55 GB) with the command tar -jxvf file.tar.bz2 However I found that the decompression process gets stuck at a certain file and, after waiting a long duration, ...
10 votes
6 answers
2k views

Fastest way to merge millions of small files together

I regularly need to transfer millions of small files (small images, txt, json) with average of 5-50k per file between servers or to aws s3. Is there a faster to merge them into a single file to ...
0 votes
2 answers
42 views

7z An Existing Tar File

I am on ubuntu 20.04 and I have a 71GB.tar file that I would like to 7zip before moving it to long-term storage. I can create a new directory.tar.7z using: #tar cf - directory | 7z a -si directory.tar....
-1 votes
1 answer
82 views

How do I extract a .tar.xz file? [duplicate]

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 ...
  • 1,627
0 votes
0 answers
21 views

Linux file compression and extraction (CentOS)

I seem to be having an issue with file extraction on centOS 7. Scenario: PC1 is collecting .csv and .txt extension files into one directory, every 5 minutes everything inside this directory is ...
0 votes
1 answer
28 views

copy directory, except for node_modules subdirectory, using tar

I'm trying to understand how to use tar in a Bash script to copy a project directory to another location while excluding the node_modules subdirectory. There was a potentially useful comment posted ...
  • 159
0 votes
0 answers
26 views

Create Multi Part Tar Archives

I am on Ubuntu 20.04 Desktop and I use rsync to back up my hard disk to my external and make a monthly tar.gz of the files. Unfortunately, my new online storage offers more space, but has a maximum ...
0 votes
1 answer
71 views

Recompress 7z archives to tar.zst on the fly

I have a bunch of 7z archives (containing directories and files) that I would like to recompress as tar.zst (which offers much better decompression speeds if / when I need to unarchive them). I could ...
0 votes
2 answers
36 views

tar processing files multiple times with find -newer

I'm trying to use tar(1) to create an archive of files newer than a specific file (fileA). However, when I use find(1) to obtain the list of files to pass to tar, some files are listed multiple times: ...
0 votes
1 answer
47 views

How to fix my tar backup

I'm setting up a server primarily as a NAS. It runs Ubuntu Server 22.04 LTS, the data is stored on a hardware controlled RAID. Obviously I want to create a backup for off-site storage and used \ tar -...
  • 3
0 votes
2 answers
232 views

Pipe find list of files into xargs gzip and pipe again into pigz

I need to find files newer than x days, and then turn it into a gzip, but I want to do it using pigz. For now I'm now doing it the slow way; this works: find /path/to/src -type f -mtime -90 | xargs ...
8 votes
4 answers
2k views

Is it possible to search through a .tar.gz file breadth-first?

I want to download part of a large (199GB) .tar.gz file from here. To start, I used the following command to list all of the files in the .tar.gz file: wget -qO- https://www.cs.cornell.edu/projects/...
  • 183
0 votes
0 answers
152 views

how to extract a multi-threading for tar.xz

I used the following command to compress a drive mounted to a folder. based on How to use multi-threading for creating and extracting tar.xz tar -c -I 'xz -9 -T0' -f archive.tar.xz /var/lib/docker ...
-2 votes
3 answers
652 views

Creating a tar.gz archive of multiple directories of different locations -- "tar: Cowardly refusing to create an empty archive"

I'm trying to create an achive: $ cd /tmp $ tar -czf test1.tar.gz -C ~/Downloads/dir1 -C ~/Documents/dir2 -C ~/dir3/dir4/dir5 ... which is supposed not to preserve the full path of the directories in ...
  • 19
2 votes
2 answers
528 views

Backup entire linux system with tar to the partition that mounted in system itself

All of my operating systems are mounted on one partition, it's /dev/vda1. Is there problem if I backup the entire Linux directory with this command root@myOS:/# tar -cJpf /mnt/bax/myOS.tar.xz . ...
0 votes
1 answer
127 views

extract tar then enter its directory (shell scripting)

How do I make script exctract tar then enter the extracted tar directory? I was trying xtract #!/bin/bash tar -xvf $1 && cd $1 Usage example suppose there's foo.tar.xz so how to use it: ./...
0 votes
1 answer
76 views

File contained in compressed TAR archive missing after decompressing

The data.tar.xz in libemu2_0.2.0+git20120122-1.2build1_amd64.deb is weird. If I use tar tvf or tar xvf there is a file ./usr/bin/sctest, but after I decompressed the archive with tar xvf, the file ./...
  • 101
0 votes
0 answers
28 views

Oneliner to archive, test the archive and remove source folder or stop if error

I've made my small shell function to un-compress the latest archive in a specific folder, then use it (code removed for sake of clarity), and then make an archive, test it and if everything is ok, ...
-2 votes
1 answer
35 views

tar unzipping old file content [closed]

Say I have a g zipped file named test.tgz with the content having a file named hello.txt and reads hello world. I would unzip it using tar -zxf and make some modifications in hello.txt to read hello....
  • 1
0 votes
1 answer
62 views

Difference in total size between files on disk and files in tar archive

I'm a new Linux user and still learning it. As I understand, the tar command (by itself and without options like z, j or J) doesn't compress files by default. It only bundles multiple files into a ...
0 votes
1 answer
480 views

Create a tar.gz file from a different directory, tar must keep files in specific directory structure

Here is my file structure. I am currently residing in test2/ directory, and all commands must run from there. test/ |_test2/ publish/ |_subfolder1/ |_f1 |_f2 |_f3 |...
  • 428
0 votes
1 answer
80 views

tar invalid transform expression error due to whitespaces over ssh call

I am using tar --transform over SSH call to rename the documents during archiving based on array DOCUMENTNAMES. tar -uvf /tmp/$TARGET''TVL_document.tgz'' --transform='s|'\${doc}'|'\$docname'|' -C /...
1 vote
0 answers
130 views

Alternatives to compressed tarballs

I am reading/writing data from/to tapes using Debian and recently ran into an issue where I needed to figure out the size of the stored data stream, i.e. the data actually written to the tape (see ...
2 votes
1 answer
143 views

Read file size from tape

I have a tape with a .tar.lzma archive written to it. How can I determine the size of the .tar.lzma archived as is? In other words, I'm looking to find the size of the compressed archive, not the size ...
1 vote
1 answer
46 views

Make tar on multiple predefined tapes

How do I tar some files to multiple tapes, with each tape being listed in advance? This way I can have a fully-unattended archival, with no need to physically change media once a tape is full. In my ...
0 votes
2 answers
129 views

Compress several files according to the pattern

I would like to know how to compress several files according to the pattern using gzip, tar, etc... that is, if I have these files: server_regTCA.log.2021.02.12 server_regTCA.log.2021.02.13 ...
0 votes
0 answers
82 views

Unable to update tar.gzip despite using gunzip in CentOS 7

I am novice to Linux. I am trying to update a tar.gzip located in /path/to/dir by another file located in /path/to/new_dir/. The file is the latest modified file in path/to/new_dir/. I am using the ...
0 votes
1 answer
93 views

How to archive and compress large dataset into parts efficiently?

Currently using following model, but one needs double the amount of disk space to restore compressed archive given one has to pipe all parts to tar before one can delete them. $ COPYFILE_DISABLE=true ...
0 votes
2 answers
435 views

How can I extract a specific file from an tar archive into the current directory?

I can extract a specific file from a tar archive like this: tar xvf gh_2.5.1_linux_armv6.tar.gz gh_2.5.1_linux_armv6/bin/gh This extracts to the current directory, but the gh file is still within the ...
  • 856
1 vote
3 answers
212 views

Linux Command to run a file

I am trying to run a Foxitreader. I have run a tar on it. But why do I need to execute the setup with Why do I have to run a file beginning with './' in Downloads? What does that mean? ./FoxitReader....
  • 37
0 votes
2 answers
96 views

How to prevent tar from removing leading slashes? [duplicate]

When I use the command tar -czf /var/backups/completa.tgz -g /var/backups/backup.info /home ... then tar says tar: Removing leading `/' from member names How may I prevent tar from removing the ...
  • 1
0 votes
1 answer
25 views

Difference between two tar commands -cf and -Jchf

I have a python script that is running in two places, two different, but similar commands: os.system("tar cf - -C %s . 2>/dev/null 3>/dev/null | 7za a -p%s -si %s 1>/dev/null 2>/dev/...
  • 177
0 votes
2 answers
3k views

Podman errors on tar with potentially insufficient UIDs or GIDs available in user namespace

When I run podman run I'm getting a particularly weird error, ❯ podman run -ti --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest ✔ docker.io/rancher/rancher:latest Trying to pull ...
  • 23.9k
1 vote
0 answers
82 views

Extracting a symlink-containing tarball on git bash

I wanted to extract a compiler's tarball on git bash on Windows 10: $ tar xzf polyml-5.8.2.tar.gz tar: polyml-5.8.2/compile: Cannot create symlink to ‘/usr/share/automake-1.16/compile’: No such file ...
  • 768
0 votes
1 answer
83 views

How to extract specific file from partially downloaded tar?

I have a large tar file but it could not be downloaded completely as the browser crashed when verifying the download. Is it possible to extract some files from this tar? I am able to view the files ...
  • 125
3 votes
1 answer
169 views

Why is it so that when tar is executed from the script I get "command not found", (it runs without giving me such output from the terminal)?

The following script does the job of archiving /home/jerzy/testdir/: #!/usr/bin/bash XZ_OPT=-9 tar -cJf /home/jerzy/testdir.tar.xz -C /home/jerzy testdir && \ echo "testdir/ already ...
0 votes
1 answer
51 views

Modify all files of a folder prior to archiving them with `tar`

Consider an arbitrary folder $DIR with files and folders in it. I want to TAR this folder to $DIR.tar, but before, as a preliminary step, in all files I want to change string occurrences of FOO to BAR ...
1 vote
1 answer
37 views

Archive directory with tar/gz to multiple locations and omit an additional copy

I have a simple backup script, which also creates a tar/gzip archive of local data to an external USB device and then copies that archive to a second USB device. For example: usb1="/mnt/usbone&...
34 votes
2 answers
5k 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 ...
2 votes
1 answer
336 views

How do I decompress a folder of files that I accidently saved as foldername.gz instead of foldername.tar.gz

I'm not sure how I did this. I had to wipe my dedicated server and start again, so I backed up everything to a remote VPS first; during this process, I compressed a folder full of other folders as ...
  • 163
0 votes
1 answer
331 views

Backup remote files with ssh|tar into archive.tar.gz

I am using the command ssh user@remote -p 22 "tar cz my-folder" | tar xz -C /d/local-backups to backup distant folders to my local drive. It is working fine, and the folders structure is ...
  • 103
0 votes
1 answer
80 views

Create a filtered copy of a .tar.gz file with unwanted files removed [duplicate]

What is the Linux shell equivalent of this Windows shell batch file command? tar czf b.tgz --exclude="dontwant.tgz" @a.tgz What I need to achieve: a.tgz has many files including dontwant....

1
2 3 4 5
24