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
2 answers
35 views

BusyBox's tar --exclude doesn't exclude

Extract a tar file with content dir1/dir2/file, using --exclude dir2 switch. The gnu tar excluded but busybox's tar doesn't. Use --exclude dir1/dir2 works fine, but why? Is there a way to exclude any ...
3 votes
1 answer
47 views

tar files with backslahes on Debian

I need to copy files that contain (Windows-style) backslahes from a Debian 10 pod. I'm having trouble with GNU tar 1.30 archiving files with backslashes: docker run --rm -it debian:10 bash inside the ...
  • 133
0 votes
1 answer
41 views

tar multiple files starting with same pattern then spaces in between the file name

I am trying tar files from a directory which has files starting with same pattern then multiple spaces in between. e.g.: ABCDEFGH Mar 09 20:02:00 2023 log.TXT.0 ABCDEFGH Mar 09 20:05:00 2023 log.TXT.0 ...
0 votes
1 answer
31 views

Is possible compress and uncompress a file with a password but considering an expiration date too?

In Linux about compression files can be accomplished with the tar and zip/unzip commands, perhaps more. I know that is possible establish a password protection for security reasons. The question is: ...
0 votes
1 answer
23 views

I get error when I want to extract tar file in the satrap folder

I am new in Linux , when I want to extract the tar file in the folder satrap I get this error : You may not specify more than one `-Acdtrux' or `--test-label' option Try `tar --help' or `tar --usage' ...
  • 3
0 votes
1 answer
35 views

tar exclude folders ignored when called from bash function

The following code didn't work, exclude folders are ignored by tar. How can I fix that ? Please note I may have multiple exclude folders and multiple folders to backup. date=`date +%Y%m%d` # ...
0 votes
1 answer
40 views

Normal gz file not extractable by tar [duplicate]

I have a gz archive but for some reason tar said that the format is incorrect even though I can double click it in mac Finder and extract it normally, and file command shows the same format just like ...
  • 1,927
0 votes
0 answers
36 views

Why does transfer of a TAR file slow down so significantly mid-transfer?

I'm trying to transfer a 30GB TAR file between two servers. My problem is transfer starts at a fast rate of roughly 10s MB/s, but after 11% of the file transfer the speed slows enormously to 100s KB/s....
  • 1
1 vote
0 answers
32 views

Why doesn't doas wget -qO- archive.tar.gz|doas tar -xz work as with sudo?

sudo wget -qO- https://go.dev/dl/go1.20.1.linux-amd64.tar.gz|sudo tar -xz works fine. doas wget -qO- https://go.dev/dl/go1.20.1.linux-amd64.tar.gz|doas tar -xz does not work. I get no input, it just ...
0 votes
0 answers
34 views

Untar an archive without creating missing directories

I have a tar archive that looks something like this: $ tar -tf archive.tar foo/ foo/bar.txt dontcreateme/baz.txt The foo directory is directly specified in the archive, but dontcreateme is not - only ...
1 vote
1 answer
31 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 ...
  • 440
0 votes
3 answers
38 views

extracting multiple tar files in folders with their corresponding file names

Hi I'm having a multiple tar files like 1.tar 2.tar 3.tar..etc and i wanted to extract them to corresponding folders i.e 1.tar to a folder named 1 and so on... my trial was like the following: for ...
0 votes
1 answer
238 views

tar -: cannot stat: No such file or directory

I'm trying to write a backup script, using the method from this answer from superuser to show a progress bar. I invoke tar like this: tar cf --exclude-vcs --exclude-ignore=.tarignore - $backup_files -...
  • 111
1 vote
1 answer
34 views

Convert tar to 7z directly?

I have a couple tarballs that are many gigabytes large and contain several thousand files and am wondering if it is possible to convert these to more versatile 7z archives, because the current ...
0 votes
1 answer
39 views

Extract all content from multiple zip files contained in compressed tar archive

I receive a tar.gz file which packages multiple zip files - reproduced below: $ rm -Rf zipdir; mkdir zipdir; echo foo > zipdir/a.txt; echo bar > zipdir/b.txt; cd zipdir; zip -m a.zip a.txt ; zip ...
0 votes
1 answer
37 views

Extract first n bytes from .tar.gz and output as a .tar.gz in a single command

I have a .tar.gz as input and want to extract the first 128 MiB of it and output as a .tar.gz in a single command. I tried: sudo tar xzOf input.tar.gz | sudo dd of=output bs=1M count=128 iflag=...
  • 3,466
1 vote
0 answers
25 views

How to extract subdirectory from tar into another tar without `sudo`?

Given A tar file with rootfs where all permissions and ownerships are set. Expected A tar file with content of subdirectory, let's say usr/local/lib where permissions and ownerships are retained. ...
  • 261
0 votes
0 answers
44 views

Shell script to Unzip and Enter directory

I am working on two shell scripts. The first accepts a number and a path. Enters said path, does and md5sum of all files then packages the files into a tar.gz. The second script accepts a tar.gz, ...
  • 113
-1 votes
1 answer
189 views

Difference between ar, tar, gzip, zip and when should I decide to choose which one?

I had a use case where I needed to pack a bunch of files into one. And all above commands does the same. I know gzip compresses my files but lets say space is not at all an issue for me then in that ...
0 votes
1 answer
57 views

Error with option --strip-components when running example from manual of tar command

When reading the manual of tar command I encountered something wrong with the option --strip-components. The example in the manual is that there is a tar file containing a directory with 3 files. When ...
  • 3
1 vote
0 answers
89 views

tar not working with sudo

I am trying to extract a file into /usr/local/ using $ sudo tar -xvzf /home/vyom/Downloads/go1.19.4.linux-amd64.tar.gz -C /usr/local/ tar (child): gzip: Cannot exec: No such file or directory tar (...
  • 123
1 vote
0 answers
61 views

Extract a list of files from tape with tar

My goal is to extract only the files in a list from an lto5 tape using tar. The data was originally written to the tape using tar as well. I am able to accomplish this task from a .tgz file by doing: ...
  • 23
1 vote
0 answers
36 views

Why did my tar backup fail?

My home directory is encrypted with ecryptfs. I wanted to try some things that required reinstalling my system, so I backed up to a flash drive with this command: sudo tar cf backup.tar.zstd --one-...
  • 335
0 votes
3 answers
61 views

Is it wrong to do tar czf somename.tar some_*_files?

Is it wrong to do tar czf somname.tar some_*_files instead of tar czf somname.tar.gz some_*_files, then of course tar xf somename.tar? That is : without adding the .gz extension. This question is ...
0 votes
0 answers
58 views

Extract subset of files in tar.gz to another tar.gz

I have some data in a gzip compressed tar file called all.tar.gz. I know I can extract my visual files (file.vis.#) to the output directory using tar -xzf all.tar.gz --wildcards --no-anchored 'file....
  • 101
1 vote
2 answers
45 views

How to use compressed archive when script expects uncompressed

I'm currently working on a program which calls a script, that converts NCBI Blast Databases from BLASTDB format to FASTA format. This script normally expects to run within a directory of an ...
0 votes
0 answers
76 views

Rofi isn't recognizing a .desktop file [i3-gaps]

I've recently installed waterfox on my Fedora system, and I've encountered an issue with my application manager, rofi. For some reason it just doesn't want to recognize the .desktop file for it, and I'...
0 votes
1 answer
114 views

Continue on Error While Extracting a tarfile

I want to continue extracting a tarfile on error, even if there is one or more corrupted files contained within the tarfile. Is this possible? I have a tarfile myArchive.tar.gz. I want to extract/...
  • 121
0 votes
1 answer
68 views

How to backup many large files to single compressed file on S3

I have an application that has many thousands of files totaling over 10TB. I'd need to backup this data somewhere (probably to AWS S3). I'd like to: compress data being backed up save the backup as a ...
0 votes
1 answer
24 views

Decompress tarred file system into mounted partition

let's say that I backed up the file system on an installed distro into the file backup.tar.gz. I have the file backup.tar.gz in my home dir and want to decompress it directly into the partition sda1 ...
4 votes
3 answers
567 views

Untar file if exists in archive

I want to extract few directories from very big tar.gz archive (lets assume aaa,bbb,ccc). ccc sometimes exists, sometimes not, but I want to avoid fails during extract process. Is it possible to ...
  • 141
0 votes
2 answers
135 views

Extract archive with BSD tar to directory with same basename

GNU tar allows to extract the contents of an archive to a directory named after the basename of the archive. $ touch foobar $ gnutar czf archive.tar.gz foobar $ gnutar --one-top-level -xf archive.tar....
0 votes
0 answers
16 views

tar "Cannot stat: No such file or directory" when space in name file [duplicate]

I have a problem when I try to use this tar command : cd /ROOT && tar -czf /ROOT/backup/test.tar.gz --exclude="backup" $(ls -A -1) All the files and folder in the current directory ...
0 votes
2 answers
73 views

ssh immediately closes connection after tar backup

I have seen a similar issue posted elsewhere, but mine seems to be slightly different. I am sshing into a Ubuntu 16 server, and it was working literally hours ago. I started a backup using tar -cvpzf ...
  • 101
0 votes
1 answer
111 views

When is mandatory use the "--keep-newer-files" option for the tar command?

About the tar command Introduction Having for example: source numbers 001.txt # with the 111 content 002.txt # with the 222 content 003.txt # with the 333 content If is created the numbers.tar....
0 votes
1 answer
2k views

"gzip: stdin: unexpected end of file" after using tar with split

I have a folder of roughly 600MB of images in a folder output_test. I then create 100MB chunks of tar.gz files using the following command: tar -czf - output_test/ | split --bytes=100MB -d -a 3 - ...
0 votes
1 answer
102 views

tar extract as a specified user : tar: /home/administrateur/glpi-10.0.3.tar: Cannot open: Permission denied

Cannot extract tar archive as www-data user, I get a Cannot open: Permission denied error : $ mkdir $HOME/tmp $ sudo chown www-data $HOME/tmp $ ll -d $HOME/tmp drwxrwxr-x 2 www-data administrateur ...
  • 1,779
2 votes
1 answer
38 views

How to change name of a folder inside tar.gz before decompressing?

I have a tar.gz called "first.tar.gz". Inside it I have only one folder called "first" (no other folders or files). I want to decompress the tar.gz, so the folder "first" ...
1 vote
1 answer
48 views

Untar file tar compressed file to different directories [duplicate]

I have a .tar.gz file which may have the following files: folder1/folder2/folder3/imp_folder1/file11.jpg folder1/folder2/folder3/imp_folder1/file12.jpg folder1/folder2/folder3/imp_folder2/file21.jpg ...
  • 11
1 vote
1 answer
515 views

How to extract the tar.gz file but without overwriting existing files?

With the unzip -n /path/to/filename/filename.zip command the compressed file is uncompressed but does not overwrite existing files. This approach is useful when the same compressed file was ...
0 votes
1 answer
158 views

How to tar files from multiple paths without including path names?

At the end of an automated job, I want to tar up some logfiles and deposit them somewhere in case they need to be analyzed. The log files are at multiple different locations on the host, and some of ...
  • 2,688
1 vote
0 answers
219 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 ...
  • 11
0 votes
1 answer
322 views

tar create: How to avoid to show the "tar: Removing leading `/' from member names" message in the terminal?

About the tar command If is executed the command: tar -czf numbers.tar.gz numbers The numbers.tar.gz file is created - from the numbers - in the current directory But for script purposes - by testing ...
-1 votes
1 answer
399 views

Why tar command uses gzip command through 'z' option?

In Linux Ubuntu about the 'tar' command for these versions: tar -tzf /path/to/filename.tar.gz # Show the content tar -xzf /path/to/filename.tar.gz # Extract the content Observe both commands use ...
1 vote
1 answer
306 views

How can install software with tar.gz file?

Here is the way i install zulu jdk: wget https://cdn.azul.com/zulu/bin/zulu18.32.13-ca-jdk18.0.2.1-linux_x64.tar.gz mv zulu18.32.13-ca-jdk18.0.2.1-linux_x64.tar.gz /opt cd /opt tar -zxvf zulu18.32....
  • 195
1 vote
2 answers
251 views

Decompress folder.tar.gz with files inside

I'm trying to decompress folder.tar.gz which was previously compressed with zstd, so I did: unzstd folder.tar.gz.zst Now if I try to decompress by using: tar -xvf folder.tar.gz It will decompress ...
0 votes
2 answers
66 views

tar suppress message "Treating date ... as ..."

In my script I try to pack the file test with: if tar czfv "/tmp/tmp.tar.gz" --mtime="$(date +'%Y-%m-%d %H:00')" "test" --utc;then I get the output tar: Option --mtime: ...
  • 26.9k
3 votes
1 answer
161 views

tar lzma autocompression produces the error "This does not look like a tar archive"

The following script mkdir test && cd test mkdir files touch files/{1,2,3} tar --create --file "test.lzma" files/{1,2,3} --auto-compress mkdir extracted_files tar --extract --file &...
  • 93
0 votes
1 answer
334 views

Unzip compressed dump and import via psql

I'm trying to dump a huge database and compress the dump in order to not have to wait hours till it's done. I dump the database the following way: pg_dump -Fc -U -v | gzip > db$(date +%d-%m-%y_%H-%...
  • 113
1 vote
0 answers
328 views

How to suppress warning messages in tar (GNU tar) 1.15.1?

On trying to tar files that are getting changed, I am receiving this message - tar: file changed as we read it. I am trying to suppress this warning message like this - tar --warning=no-file-changed -...
  • 21

1
2 3 4 5
25