tar

tar: don't change date if file is the same

tar: don't change date if file is the same I’m using tar to extract files during a deployment process. I’ve noticed that systemctl issues a warning that daemon-reload must be run if a .service file has its timestamp changed, even if the file contents remain the same. How can I configure tar to not change …

Total answers: 1

tar alternative to bsdtar –include

tar alternative to bsdtar –include I’m trying to adapt a script that uses bsdtar, which is not available on my Linux distribution. bsdtar -x -f <file> –include="SOME/FOLDER/" What is the alternative of –include in tar command? Asked By: mkrasowski || Source From old Solaris documentation: you can use something like: tar -xf <file> $(tar -tf …

Total answers: 2

specify different –mode values using GNU tar

specify different –mode values using GNU tar I am trying to use GNU tar to create a tarball from a directory stored on a network drive. This network drive defaults the mode of everything stored on it to 0700 (-rwx——) and cannot be changed prior to the tarball creation. I had used this command to …

Total answers: 3

Tar through ssh – how add exclude in one line command from local pc

Tar through ssh – how add exclude in one line command from local pc ssh root@1.1.1.1 tar cvpf – /root/1 > /home/user/arc.tar.gz need add –exclude=/root/1/2 i try and not work: ssh root@1.1.1.1 tar cvpf – /root/1 > /home/user/arc.tar.gz –exclude=/root/1/2 Asked By: ывапав || Source GNU tar reports exactly what’s going on. Since you are using …

Total answers: 1

Why does tar's handling of stdout and – differ?

Why does tar's handling of stdout and – differ? After a comment from OP, I discovered that /dev/stdout gives blocks of 10 KiB even after disabling buffering, but – does not. Why is this? I could not find anything regarding this in man tar nor man stdout. Note that /dev/stdout goes to 00002800, not 000000a1. …

Total answers: 1

How to tar xf glib-*.tar.gz correctly?

How to tar xf glib-*.tar.gz correctly? I downloaded glib-2.76.3.tar.xz from https://download.gnome.org/sources/glib/2.76/ Extracted the file and opened the INSTALL.md inside of it. Here’s an excerpt of it: Simple install procedure ======================== “`sh tar xf glib-*.tar.gz # unpack the sources cd glib-* # change to the toplevel directory meson _build # configure the build ninja -C _build …

Total answers: 2

Why is uncompressed tar much faster than rsync?

Why is uncompressed tar much faster than rsync? I’m currently looking for a way to improve my system backup performance and realized the following during some tests: Backing up my Ubuntu system from an SSD to an HDD (both ext4) using TAR without compression is much faster than rsyncing the same content from SSD to …

Total answers: 3

Merge the split file vs Original compressed file

Merge the split file vs Original compressed file On Ubuntu 22.04, I found these 2 methods will get different sha256 of archive_tgz tar czf /a/archive_tgz . tar czf /dev/stdout . | split -d -b 200M – /a/archive. && cat /a/archive.* > /a/archive_tgz Is it normal or about block size of file? What’s the difference? Asked …

Total answers: 1

tar command with and without –absolute-names option

tar command with and without –absolute-names option I am currently using ubuntu 20.04 machine. I was trying to create compressed archives using tar command using the below command, sudo tar -caf /opt/archive.tar.bz2 /home/bob/databases/ my current working directory is /home/bob. when using with -P (–absolute-names) option, the content of the compressed archive is coming as below, …

Total answers: 2

Untar multiple files in a directory

Untar multiple files in a directory There are multiple .tar files in a directory. I am trying to extract them all. The following command works for a in $(ls -1 *.tar); do tar -xvf $a; done But when I try following command, it prints all the file names but does nothing. It does not extract …

Total answers: 1

tar files with backslahes on Debian

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 container, for example, run: touch C:\LOG_DOTNET\1 touch C:\LOG_DOTNET\2 files with backslashes: ls -l C:* -rw-r–r– 1 …

Total answers: 1

tar extract ignore timestamp

tar extract ignore timestamp I create myarchive.tar on machine A and use tar -xvf myarchive.tar on machine B where tar complains about timestamps : tar: lib/libboost_date_time.so.1.65.1: time stamp 2023-02-27 20:06:01 is 254449.1210593 s in the future Does this mean that the shared lib did not get extracted? If so, how do I use tar so …

Total answers: 1

Normal gz file not extractable by tar

Normal gz file not extractable by tar 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 any other tar.gz files Why is that and how …

Total answers: 1

tar -: cannot stat: No such file or directory

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 -P | pv -s $(du -csb $backup_files |awk ‘{print $1}’|tail -n 1) | gzip > …

Total answers: 1

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

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 -m b.zip b.txt; cd ..; tar -czvf zipdir.tar.gz …

Total answers: 1

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

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=fullblock | sudo …

Total answers: 1

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

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 listed with the tar command it looks like this: …

Total answers: 1

Creating tar files without including the directories

Creating tar files without including the directories I am fairly new using tar having used zip files in the past. I want to just create the tar file without the directories being included. I went here, but found it a bit confusing. https://www.baeldung.com/linux/tar-archive-without-directory-structure # Backup crontab crontab -l > /home/andy/bin/crontab_backup.txt tar -cvf /home/andy/bin/crontab_backup.tar /home/andy/bin/crontab_backup.txt Asked …

Total answers: 3