Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [tar]

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

0
votes
1answer
17 views

Change filesize unit with a tar command

How can I change the filesize unit that is output by the tar command? tar tvf test.tar.gz | awk '{print $5,$9}' I would like for it to print the filesize in Gigabytes.
-1
votes
0answers
24 views

How to install ichat (*.gz.tar) on debian [closed]

My actions. I use Debian8: curl http://hem.bredband.net/alivor/ichatsrvd-0.21-freebsd.tar.gz > ichatsrvd-0.21-freebsd.tar.gz tar xzvf ichatsrvd-0.21-freebsd.tar.gz cd ichatsrvd-0.21-freebsd.tar....
0
votes
3answers
42 views

LINUX: tar: You may not specify more than one '-Acdtrux', '--delete' or '--test-label' option [closed]

sudo tar xuzf splunk-7.2.4-8a94541dcfac-Linux-x86_64.tgz -C /opt I get the following message: tar: You may not specify more than one '-Acdtrux', '--delete' or '--test-label' option Try 'tar --help' ...
1
vote
1answer
18 views

How to untar all .tgz files in a folder and write to new files with different Naming convention

I have folder thay contains many .tgz files, each uncompressed file has SAME file name "000000_0". Can someone write me a command to do below? 1. Untar all the .tgz files from a folder 2. rename ...
0
votes
1answer
24 views

Create or Update if exists tar file

I ran into that problem today when I wanted to tar all files and directories in a specified directory. Doing the following is not enough because hidden files (ones starting with . won't be included): ...
2
votes
2answers
48 views

How can I tar and gzip my web directory files and download (using rsync) it in one command from my local machine?

I'm rewriting my original question because I realized this is more efficient: I'd like to tar and gzip my website files and then download it. I know I can tar and gzip it with one command using tar ...
0
votes
1answer
27 views

Script “7 days log tar and then remove the 7 days logs and exclude the tar file after next 7 days”

I am trying to create a script such that it could tar.gz all the previous log of per 7 days log and exclude the tar file in next run. Is the script ok or should I have to make a change find /home/...
0
votes
0answers
23 views

Is it possible to dynamically add to a tar.lrz file?

A bit of a basic problem, I'm slightly embarrased I'm running into it, however man lrztar didn't show me any commands for this. Basically, lets say I've got an archiving station which handles ...
0
votes
2answers
106 views

Can't tar files: Refusing to read archive contents from terminal

I have host without dpkg so I need to install it. I followed the instructions from here and here. On both of these answers they wrote that I need to download the file: wget http://security....
-1
votes
1answer
57 views

tar with ssh: what happens if creation speed is higher than network speed?

I'm concerned what will happen if speed of source read + stream create operations gets higher than underlying network protocol speed? Is tar going to create and cache data locally before it is ...
1
vote
1answer
37 views

Gzipped archives - Create using tar -czf and extract using only -xf?

Say I have a file.txt containing one line: strawberry Using tar -czf archive.tar.gz file.txt I can create a "gzipped archive" with the name archive.tar.gz, which is to my knowledge the equivalent ...
0
votes
2answers
35 views

How to tar a directory including dotfiles, but omitting all reference to the directory itself

I want to back up home directories including the usual array of dotfiles, but I do not want the directory itself, or its permissions to be backed up or even mentioned. So, if I have a structure like ...
0
votes
0answers
22 views

tar: compare/verify in conjunction with transform

Is there an efficient way to verify a written tar-archive with transformed file names? Assume I have a file called foo and want to store it in the archive as bar, I would create the archive foobar....
5
votes
3answers
217 views

Portable way to invoke tar with a list of files from stdin

I want to create a .tgz from the content of a directory. I also want to strip the leading "./" from the tar'ed content. I had done this as follows: cd /path/to/files/ && find . -type f | cut -...
1
vote
0answers
37 views

Need to edit a single file in a tar.gz using Python [closed]

Vim provides the ability to edit a single file in a tar.gz without unarchiving. ( i.e. vim some_archive.tar.gz ) How could I script the same type of operation using Python?
2
votes
1answer
51 views

pipe of tar and tree commands?

I would like to see the tree of a big compressed file (specifically only the second level of directories) so I used the following command: tar -tf tarfile | tree -L 2 But it outputs the tree of the ...
0
votes
1answer
46 views

Pass space separated arguments stored in variable to command

I've hijacked a pretty neat backup script from the internet but somewhere along the lines there is something like this going on DIRS="/home/ /var/www/html /etc" tar -czf /backup/file.tar.gz "${DIRS}"...
0
votes
0answers
50 views

problem with find xargs and tar concatenation

I want to store all the png files in a directory tree. I used find . -iname *.png| xargs tar -czf renderresultsall.tar.gz but I get only a part of the files, some directories are missing e.g. ....
1
vote
1answer
81 views

tar --list only top level files and folders

using tar --list --file=x will list all files and folders. I am just looking to list the top level files and folders does anyone know how to do that? alternatively, does anyone know how to list only ...
0
votes
0answers
42 views

How to archive into multiple zip a directory containing several millions sub directory?

I have large directory that contains several millions+ sub-dir, each sub-dir contain 3 or less image files. What is the most efficient way for me to zip them so I can move it to a new server? The sub-...
4
votes
0answers
52 views

Limit tar read speed

I'm using tar do make backups of a machine. But, it is using a lot of I/O and slows down the whole machine. So, is there a way to limit the read speed of tar? I know about pv, but it limit only the ...
1
vote
0answers
55 views

tar takes a long time before passing data to gzip

What I want to know, is what is tar doing at the start, before it starts passing data on to gzip? Can I make it skip that step? I'm writing a script to run on my Synology NAS box (running DSM 6.2.1-...
0
votes
1answer
18 views

using sudo with piped command on Ubuntu server

If I need to use the following backup command on an Ubuntu server with sudo, how do I do so? Do I need sudo at two places? tar cf - directory | 7za a -si directory.tar.7z
0
votes
4answers
65 views

Is it possible to tar only sub directories excluding other files in the folder?

For example, suppose A/B/C is the main directory. Under the C directory, I will have sub-directories and files. But I want to tar only the directories with its own name as below If the directories ...
3
votes
1answer
58 views

What does cat of a tar archive show? [closed]

I was doing a penetration testing capture the flag training exercise and found a file called "backup". I checked the file type of "backup" and saw it was gzip compressed. I decompressed it to a file ...
0
votes
1answer
49 views

Problem with find excluding files of type socket when creating tar archive

I am trying to make a tar archive of all files in my /var directory. Naturally, I want to exclude the Unix sockets in there. So I try a command that looks something like: sudo find /var \! -type s ...
1
vote
1answer
88 views

tar: compress text stdin and stdout [duplicate]

Using tar, is it possible to compress stdin text and have the compressed data appear in stdout? Example: $ echo "test" | tar c - <compressed blob here> I'm using macOS Mojave.
-2
votes
1answer
30 views

tar directory and exclude multiple subdirectories

I'm trying to tar a whole directory except some subdirs.. The dir my-base-dir is zipped but the excluded dirs/files are also included? tar -cf my-base-dir/bak/site/site.tar my-base-dir --exclude=my-...
0
votes
2answers
33 views

Keep only a certain amount of backups (tarballs) in a directory

On my debian 9.4 machine I have a script that automatically compresses & backups up all my files in a srv/ with the date in the name xx-xx-xxxx.tar. It is moved to my backups/ directory. I would ...
2
votes
0answers
78 views

tar restore --listed-incremental timestamp is in the future

I have some backups that were created using tar --listed-incremental features. When I restore the individual backups one after the other using tar -xf archive.tar I get no warnings but if I restore ...
0
votes
2answers
66 views

Unable to create tar with xz compression of a directory to another directory

I am trying to create a tar archive with xz compression of my home directory to another non-existent directory, but it gives me error: tar: Cowardly refusing to create an empty archive The command ...
0
votes
2answers
42 views

How to detect the type of a file in tar.gz

I want to detect the type of a file, which is compressed into a tar.gz, but I don't want to extract it. In a word, is it possible to execute a command (such as file) onto a file in a tar.gz without ...
0
votes
1answer
45 views

backup with tar

I have found that I need this command to make a full backup of the Etc folder tar cJPf /srv/dev-disk-by-label-Share/Myfiles/$(date +%F)-$(hostname)-etc-tar.xz /etc/ But what command do I need to ...
0
votes
2answers
36 views

How may I give the current time as the modification time for a file or directory in a tar archive

I want to create a tar archive which will have files and directories. I need to change the modification time of these files and directories so that their modification timestamp is the current date and ...
2
votes
1answer
55 views

What's the difference between backing up files in an AIX system using either “tar” or “backup” commands?

In AIX systems there are the command backup and its counterpart restore meant to make and restore backups, respectively. But what are the advantages of using them instead of a well-known tar command ...
0
votes
1answer
81 views

tar returns error but still unpacks file even though “tar --no-ignore-command-error -xvzf file.tar.gz” is used

I have a corrupted file called file.tar.gz and I want to the extraction of it to fail. I used tar --no-ignore-command-error -xvzf file.tar.gz but it still extracting the files, and ignoring the errors:...
0
votes
1answer
28 views

concatenating 2 commands with tar (wc -l + echo ok || echo fail)

I want to do 2 things with a tar.gz file: Check for failure If successful - check number of files extracted I found this for the 1st option. I now run my command like this: tar -xvzf bad_file.tar.gz ...
18
votes
1answer
3k views

Why does piping `tar` into `dd` not stop until the disk is full?

I have a tar archive of a single disk image. The image inside this tar file is about 4GB in size. I pipe the output of tar xf into dd to write the disk image to an SD card. The diskdump never stops ...
4
votes
1answer
166 views

Why does tar have a low CPU usage but high system load?

I'm using tar to backup my server once every day. Even though CPU usage (of the tar command and the system overall) doesn't go over 10%, my system load is like 3.98 3.71 3.82 when the script is ...
9
votes
2answers
826 views

Build a command dynamically

I'm working on a script and I need to build the tar command dynamically. Here are two examples to illustrate what I'm trying to do : #!/bin/bash TAR_ME="/tmp" EXCLUDE=("/tmp/hello hello" "/tmp/...
1
vote
2answers
421 views

tar “Cannot stat: No such file of directory” when passing array variables [closed]

I'm trying to write a bash script that will create an archive (tar) of files in a directory. The file extensions need to be passed in as arguments when calling the bash script (./backup.bash pdf txt ...
1
vote
1answer
36 views

Customize “tar --list” date format

This is tar's output when listing files in a tarball: > tar zvtf my.tar.gz -rw-rw-r-- myuser/mygroup 2363 2018-05-03 15:45 test.txt Is there any way to customize the date format to print out ...
0
votes
1answer
36 views

Is there an efficient command for listing the header of a particular file in tar.bz2 without uncompressing/extracting?

I was working with a data.tar.bz2, which contains lots of other big files of the scale of a few hundred Gigabytes. I just wanted to see the header (first line) of a particular file file-of-interest, ...
1
vote
2answers
266 views

Extract folder content using tar?

There is a similar question here. If I understand correctly, the first answer indicates that we cannot extract the contents of a folder, but only a specific file from a folder? The second answer ...
0
votes
1answer
32 views

tar -C with certain files in the direcory [duplicate]

Let's say I have two directories that I would to tar without retaining the directory structure: /root/dir1 /root/dir2 Also, I would like to backup only files that begin with say f1 in /root/dir1 and ...
0
votes
1answer
25 views

While doing untar, files should be deleted from disk which are not present in archive of untar

Suppose I have three files on disk as f1,f2,f3 and one folder is present and in my archive only f4,f5 files are present. So after untar operation I wanted f1,f2,f3 files to be removed/deleted as they ...
0
votes
1answer
49 views

Verify an unpacked tar archive

Is it possible to verify that a tar archive has been extracted correctly? Like a checksum of the extracted directory? For some reason, certain files extracted by tar are erroneously created as empty ...
0
votes
1answer
280 views

Extract tar to a directory, removing any files it contains NOT present in the archive

Say I have a large tar, the contents of which I am regularly extracting to a constant location. I am wanting to keep this location a pristine instance of the extracted tar, and I could avoid the ...
1
vote
2answers
62 views

Preventing un tar from using too much CPU

I am running un tar i.e tar xzvf abc.tar.gz on Beaglebone green. This seems to be using too much CPU. When a untar operation is in progress, i see via top command the CPU usage.. not sure why it seems ...
1
vote
1answer
88 views

What's the difference between tar -A and tar -r?

I read that tar -A means: add archives to the end of an existing archive; tar -r means: append files to the end of a tar archive. Do they not mean the same thing? Could anyone please explain the ...