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
41 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: ./...
user avatar
0 votes
1 answer
39 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 ./...
user avatar
  • 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, ...
user avatar
-2 votes
1 answer
29 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....
user avatar
  • 1
0 votes
1 answer
44 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 ...
user avatar
0 votes
1 answer
21 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 |...
user avatar
  • 285
0 votes
1 answer
38 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 /...
user avatar
1 vote
0 answers
93 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 ...
user avatar
2 votes
1 answer
101 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 ...
user avatar
1 vote
1 answer
40 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 ...
user avatar
0 votes
2 answers
34 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 ...
user avatar
0 votes
0 answers
23 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
0 votes
2 answers
87 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 ...
user avatar
  • 924
1 vote
3 answers
134 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....
user avatar
  • 37
0 votes
2 answers
42 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 ...
user avatar
  • 1
0 votes
1 answer
21 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/...
user avatar
  • 177
0 votes
1 answer
1k 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 ...
user avatar
  • 22.4k
1 vote
0 answers
37 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 ...
user avatar
  • 758
0 votes
1 answer
50 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 ...
user avatar
  • 125
3 votes
1 answer
85 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 ...
user avatar
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 ...
user avatar
1 vote
1 answer
29 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&...
user avatar
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 ...
user avatar
2 votes
1 answer
283 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 ...
user avatar
  • 163
0 votes
1 answer
134 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 ...
user avatar
  • 103
0 votes
1 answer
68 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....
user avatar
4 votes
2 answers
515 views

Unable to choose compress program

I can't choose the compress program while using tar v1.26. While this works tar -c -I 'xz' -f foo.tar.xz * This won't work: tar -c -I 'xz -T0' -f foo.tar.xz * tar (child): xz -T0: Cannot exec: No ...
user avatar
1 vote
0 answers
23 views

ssh_host_[algorithm]_key group owner changed after OS restoration

I've this weird problem which I can't find an answer. Recently I restored a linux machine (RHEL 7.3) from the OS tar archives. Steps taken are as below: Create OS related filesystems tar archives, ...
user avatar
  • 11
0 votes
0 answers
77 views

How to open a tar file without using tar xfvz command line?

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:...
user avatar
0 votes
0 answers
30 views

tar compress only if source files updated

I am implementing a process in which a tar.gz file is created that compresses various files needed from the process. When this compression is done I don't want it to be compressed again, or crush the ...
user avatar
  • 101
0 votes
1 answer
83 views

How might I direct the output of "wget -qO- whatever.tar.gz" to both tar and sha256sum?

The following creates csfile with a hash in it, unpacks go1.17.4.linux-amd64.tar.gz downloaded from Golang's official website, prints out the checksum to stdout and then removes the no longer needed ...
user avatar
1 vote
2 answers
164 views

Tar pipe to xz results in broken pipe

I have a backup script that runs the following commands: tar -c dir1 dir2 | xz -9 -T0 | gpg -c --batch --passphrase xxx | aws s3 ... The return values are always the same: tar fails with 141 (broken ...
user avatar
  • 2,281
0 votes
1 answer
51 views

Tar each top level directory separately

How can I create tarballs for a series of directories? E.g. if my home directory contains directories called “one” “two” “three” and “four” how can I create one.tar.gz two.tar.gz three.tar.gz and four....
user avatar
0 votes
1 answer
123 views

How to manage tar files when creating incremental backups

I use incremental backup using tar --create --file=/home/blueray/Documents/backup/dest/$(date +%Y-%m-%d-%H-%M-%S).tar --listed-incremental=/home/blueray/Documents/backup/dest/usr.snar /home/blueray/...
user avatar
  • 1,201
0 votes
1 answer
53 views

Please how do I retrieve files saved in STDOUT after using the extract while downloading function?

I used the below function to download a large tar.gz file and extract it simultaneously. The files are now saved in STDOUT. Please how do I move them to a different file directory? wget -q -O - target ...
user avatar
  • 1
0 votes
1 answer
50 views

How can I see any tar progress when I use `--xform`

I have following function in order to extract discarding directory structure. tarx() { STRIP=${1%.*} # strip last suffix NAME=${STRIP%.tar} # strip .tar suffix, if present tar -xvf "...
user avatar
  • 230
1 vote
0 answers
59 views

TAR returns 1 on big directories - how to ignore this?

I'm running the following sequence for backup purposes: $> set -o pipefail $> tar -c /vary/large/folder1 /very/large/folder2 | xz ... | gpg ... | aws ... $> echo "${PIPESTATUS[0]} ${...
user avatar
  • 2,281
2 votes
2 answers
236 views

Tarring-gzipping only hidden directories (or files + directories)

Based on this, to tar all hidden files in the current directory one can use ls -A | egrep '^\.' | tar cvf ./test.tar -T - However, how can one tar only all hidden directories or all hidden directories ...
user avatar
  • 241
2 votes
3 answers
363 views

tar list full filename without directory

I have a tgz file with the following file structure - folder - subdir1 - file1.txt - file2.text - subdir2 - file1.txt When i run tar -tf folder.tgz, it outputs the following:...
user avatar
0 votes
1 answer
61 views

Exclude directory from tar

I try to compress my wordpress directory /srv/www/vhost/wp-intranet. But I need to exclude the directory /srv/www/vhost/wp-intranet/wp-content/uploads/ First I changed directory to /srv/www/vhost/ ...
user avatar
  • 1,708
0 votes
1 answer
525 views

No space left on device in Linux although enough disk space and inode available

I ran into this problem when copying a lot of files using tar -cf - * | (cd ../bar; tar -xf - );. I did search on the issue, and found the below suggestions, none of which worked for me. This problem ...
user avatar
1 vote
1 answer
82 views

Kinda complicated tar based on modified date

Okay, I think this is possible, but I can't quite figure it out. This is the situation. A folder contains the log files of all the processes on my robot. The structure looks sort of like this: $ ls -...
user avatar
0 votes
2 answers
936 views

How to pipe a file as input to tar command

I get the following error when trying to uncompress piped tar file with the following command : $ git archive --format=tar 0af62b1 | tar -xf -C /the/path/here/ tar: -C: Cannot open: No such file or ...
user avatar
1 vote
0 answers
33 views

How to tar-gzip a directory and put it in the /tmp

Hey im stuck on a assignment and i dont know how to solve it really because iam quite new with working in linux. I have to place a directory in a tar-ball and zip it using gzip. At the moment this is ...
user avatar
1 vote
1 answer
77 views

Tar's -r flag name meaning

Why tar flag used to append file to the archive is named -r? Other flags' names have some explanations (-x for eXtract, -C for Change current dir to another for output, ..) but I can't get how to ...
user avatar
0 votes
1 answer
56 views

How to forward output of split to sftp?

I have a server that is running out of disk space. I want to move some TB sized directories into a long term archive. This is a tape robot with preferred file size of 16GB. Therefore I want to split ...
user avatar
  • 15
4 votes
1 answer
109 views

tar --from-files, does not interpret hyphen at beginning of a filename

We are using tar 1.26 on CentOS 7.9 and I'm trying to untar an archive that has files in it which begin with a hyphen. I tell tar through --files-from which files I want to extract, since I don't want ...
user avatar
  • 175
0 votes
2 answers
84 views

I cannot untar a zip file keep getting error

From the link below I try to follow the steps and I got the curl portion to work but when I type tar zxf admit.tar.gz I get tar: Unrecognized archive format tar: Error exit delayed from previous ...
user avatar
0 votes
1 answer
301 views

Extract tar.gz file to the same filename

I tried to extract filename1.tar.gz but I got the different name which is the folder archive inside lets say archive_folder; how I can extract the tar.gz with the same name of the filename. I use this ...
user avatar
  • 1

1
2 3 4 5
24