An archive file format (and the program that reads it) commonly used on Unix and Linux.

learn more… | top users | synonyms

5
votes
2answers
2k views

Show tar files sizes

I've got a bad backup script including an unwanted file. The .tar.gz backup file is 5gig big and I'd like to get a list of every file in the archive and their size. Is that possible ? How would you ...
5
votes
1answer
2k views

extract a few members from tar archive and pipe through network

edit: I want to extra member01 and member02 and directory blah/ tarball_1.tar.gz contains directory test/ with 20 files. I want to extract only member test/member01 and test/member02 and directory ...
5
votes
3answers
107 views

Unarchive file while reducing size of archive?

The dilemma: I have a 10GB archive and a 20GB harddrive. When I go to unzip / unarchive the file the harddrive fills up and the process fails. Question: On ubuntu server 12.04 / linux is there a way ...
5
votes
3answers
2k views

Use tar vs bzip2 for creating a .tar.bz2 archive?

I just read that tar can create .tar.bz2 files. All this while, I was using tar + bzip2 to do this. I was wondering if there was a difference between using tar to create the archive vs using bzip2? ...
5
votes
1answer
157 views

Why does the ls command require a dash before its parameters but for tar command, the dash is optional?

I am new to Ubuntu and I am trying hard to understand the command line. When I want to see the contents of a tar file I use: tar tf tarfile.tar But when I want to see a listing of all file if I ...
5
votes
2answers
552 views

How to untar in Emacs dired?

Is there a simple way to untar files in Emacs Dired? Currently I'm doing a M-! tar -xvf <filename>, however I feel like there is be an easier way.
5
votes
3answers
4k views

rsync hack to bounce files between two unconnected servers

Here's the connection: [Server1] <---> [my desktop] <---> [Server2] Server1 and server2 are not permitted to talk directly to eachother (don't ask). My desktop, however is able to ...
5
votes
2answers
3k views

Equivalent to tar's “--strip-components=1” in unzip?

I have a script that extracts a tar.gz-file to a speificed subdirectory mysubfolder: mkdir mysubfolder; tar --extract --file=sourcefile.tar.gz --strip-components=1 --directory=mysubfolder; Is there ...
4
votes
2answers
499 views

How make a compressed tar when there are too many filenames for the shell to expand on a single line?

Normally I would just do something like: tar -czf archive.tar.gz *.csv But when there are too many files in the directory for the shell to expand on a single line this doesn't work. In these cases ...
4
votes
6answers
15k views

Linux: what is a most convenient way to see the content of .jar file

What is a most convenient way to see the content of .jar file w/o using unzip/untar commands? What I'd like to do - is to browsing inside using cd command like it is the usual folder, seeing content, ...
4
votes
1answer
6k views

Put date into backup .tar.gz filename

I'd like to run a simple tar command to backup my website directory. It will run through cron, but I want to be able to put the time at which the backup was made as the filename. I don't really mind ...
4
votes
3answers
5k views

Using find and tar with files with special characters in the name

I want to archive all .ctl files in a folder, recursively. tar -cf ctlfiles.tar `find /home/db -name "*.ctl" -print` The error message : tar: Removing leading `/' from member names tar: ...
4
votes
1answer
332 views

Tar - split files

i am using the following command to backup and sql file: tar -zcvf "$BACKUP_DST/$FILE_NAME.tgz" "$BACKUP_DST/$FILE_NAME.sql" i want to make sure the compressed file wont be larger then 300mb, if it ...
4
votes
1answer
2k views

tar/bz2 compress a file removing uncompressed original

Is there any way to turn a directory called dir1 into dir1.tar.bz2 without keeping the original? I need to save space and want to compress some large files but don't have enough room to keep a ...
4
votes
2answers
3k views

SunOS tar filename is greater than 100

On a Solaris when creating a tar archive using the cf options: tar cf file.tar dir and when many nested directories generates very long path names, I get the error: tar: filename: filename is ...
4
votes
2answers
6k views

How to extract a single folder and its subfolders from a “tarball” (.tar.gz)

I need to extract a single folder and its subfolders from a tarball (.tar.gz) on a CentOS server. I haven't the slightest clue how to do it using an SSH terminal. I tried: gunzip -c ...
4
votes
1answer
4k views

How to tar/untar the output on the fly

What is the idiomatic way to do the following tar to stdout read this tar output from stdout and extract to some other folder. My solution is tar --to-stdout .. | tar -C somefolder -xvf - But ...
4
votes
1answer
3k views

What's the meaning of the different “removing leading slash” warnings?

I'm using gnu tar with a few instances of --exclude specified. I get both the Removing leading / from member names and Removing leading / from hard link targets warnings. What's the difference ...
4
votes
1answer
856 views

zip/tar/? files with depth parameter

I would like to zip files from a directory but only to a given depth. In the example below I would like to include files until a depth of 3: dir0/ dir1/ dir2 -> subdir1, subdir2 dir3 ...
4
votes
1answer
1k views

How to use tar to compress only two files in a directory?

I'm trying to compress only two files in a directory. Let's say I have a directory named 'images'. In the directory, I have a.jpg, b.jpg, c.jpg, and d.jpg. I like to compress only a.jpg and b.jpg ...
4
votes
2answers
727 views

How to make TAR to not save the directory hierarchy

system("tar -czf #{RAILS_ROOT}/tmp/export-result #{RAILS_ROOT}/tmp/export") When I decompress the resulting file I get app/c3ec2057-7d3a-40d9-9a9d-d5c3fe3ffd6f/home/tmp/export/and_the_files I ...
4
votes
3answers
2k views

how do I use tar -C on Snow Leopard when creating an archive?

The man page states -C directory In c and r mode, this changes the directory before adding the following files. However, tar does not change to the directory I specify, but instead reports ...
4
votes
1answer
45 views

Tar using progress bar and handling multi-volumes

I'm trying to create a tar of a large LVM volume onto multiple external drives. That part is solved. Now, because it is a LONG process, I'd like a progress bar. From the excellent articles here, ...
3
votes
3answers
515 views

Weird bug in 'tar' not including files named .__init__.py

Does anyone know why tar is not including files named .__init__.py (note the dot)? $ mkdir /tmp/work && cd /tmp/work $ mkdir foo $ touch foo/.__init__.py $ touch foo/.namespace__init__.py $ ...
3
votes
2answers
296 views

is it plausible that Ubuntu's wildcard * with tar is somehow failing to restore some files?

In this command line sequence I use a *.sh wildcard to restore some files. I got three hits. Knowing that there must be more, I typed in the whole name. For example: goFindRanges.sh. I was able to ...
3
votes
3answers
343 views

Opening up a .tar file on Windows

What Windows tool or program can I use to open a .tar file? I also have .tar.gz files that I would like to open.
3
votes
5answers
4k views

tar - exclude does not work

I've supposed to archive a directory with tar and exclude some files. I have a directory $HOME/java which includes some .java and .class files. What I want to do is exclude all .class files using the ...
3
votes
3answers
3k views

What does `tar -C` mean?

In the section "Installing Portage", the Gentoo installation docs say: # tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr What does this command do?
3
votes
1answer
78 views

Why does tar with -z option create archive with different hash everytime

Can you tell me why tar czf archive.tar dir creates archive with different hash everytime (I check with 'md5sum') Without compression parameter -z or with parameter -j instead all works fine. ...
3
votes
2answers
1k views

How can I automatically remove files after they've been archived?

How do i archive and remove excess files example. cd ~/Desktop && tar -cvf sitepack.tar ./ this will give me ls Riva_Starr_Feat._Noze_I_Was_Drunk_Official_Video_HD_.mp3 ...
3
votes
1answer
212 views

tar file extraction, why file size reduced

We commonly know that compression is the reduction in size of data in order to save space or transmission time, I should expect bigger size when I extract compressed file. I have downloaded a file in ...
3
votes
1answer
2k views

Why is my tar.gz file corrupt after using bash ftp to move file to a remote server?

I back the tar.gz file up on the local server, then ftp it to a remote server. If I pull it to my desktop via ftp client from the local server, the file works fine. If I pull it to my desktop via ftp ...
3
votes
3answers
4k views

Is it OK to copy (not clone) a git repository using basic Unix commands?

I’m pretty new to using git and was wondering if it’s ok to copy a Git repository with common UNIX commands (like cp or tar/untag), rather than through git clone. I’m in the situation where I have ...
3
votes
3answers
292 views

tar: million of files

I have to pack circa 7,000,000 small files. I'm looking for an efficient way to do this. Is tar the best way? What about benchmark tests or any other suggestion?
3
votes
3answers
388 views

Display deflation percentage of tar command (like zip command)

This question may sound weird but I would like to know if there is a possibility to display the deflation percentage of the files processed in the tar command. I use this command tar -cjvf ...
3
votes
2answers
3k views

tar -C with a wildcard file pattern

Can I use the tar command to change directories and use a wildcard file pattern? Here is what I am trying to do: tar -cf example.tar -C /path/to/file *.xml It works if I don't change directory ...
3
votes
3answers
616 views

linux tar -T - does not work on the fly

I found some problem with linux gnu tar. wheh I use option -T - (for file list from stdin) or -T named_pipe_file , this desn't work on the fly. for example, simple interactive script: while ...
3
votes
6answers
2k views

How to extract tar.gz on windows xp

Can anyone suggest me ways to extract tar.gz file on windows xp ? Is there any built-in tool ? Or may be a script that can be written ? PS: Please note I can't install new software on my computer (do ...
3
votes
2answers
1k views

How to stop tar from archiving the root path to files?

When I run the following command: tar cfvz backup.tar.gz /path/to/my/files/* It gzips the entire path. So when I unzip the file, I have to go open 4 folders (path -> to -> my -> files) to get to ...
3
votes
1answer
534 views

List full timestamps of files in a tarball

I have a large tar archive and want to see the exact (nanosecond) timestamps that are stored for each file in the archive. In case it's relevant, the tarball is in POSIX-2001 format (tar ...
3
votes
2answers
2k views

Specify root dir inside tarball

Is there a way to execute tar cjvf foo.tar.bz2 project-root Such that when the tarball is extracted, it doesn't extract to project-root, but instead extracts to something else? i.e. tar xjvf ...
3
votes
4answers
1k views

Browsable compressed filesystem archive with full attributes?

Maybe a variation of the whole question would be: Are there any other archiving tools than tar that preserve Linux file permissions and user/group flags? I want to create archives of a directory tree ...
3
votes
1answer
656 views

Importing to mysql from a .gz via shell - how to do it without extracting to a file? [duplicate]

Possible Duplicate: Pipe gunzip and mysql to gunzip a dump and import it i have a .gz file of an sql dump. at the moment i extract it to its own file (ie dump.sql.gz extracted to dump.sql) ...
3
votes
1answer
3k views

Tar backup with progress bar

I would like to add a progress bar to my tar backup command. I found out that the bar shell script should be able to do this, but I am unable to figure out the correct command. sudo tar pzcf - ...
3
votes
1answer
162 views

gunzip -c equivalent for tar.gz files?

What is the equivalent of gunzip -c to pipe the content of a bunch of tar.gz files without having to permanently "tar xzf" them and "tar czf" them back? Something like: tar xzf "-c" *.tar.gz | xargs ...
3
votes
2answers
1k views

Installing Subversion on Unix machine

I'm new to unix and trying to create a guide for users to install subversion. I've found a tutorial about how to build from a tarball. I'm ready to try it out, but I don't know how to download the ...
3
votes
1answer
468 views

merge all tar files on mac

I have a bunch of tar files such as a.tar b.tar. I use the following command to merge two tar files : tar --concatenate --file=a.tar b.tar However, --concatenate is not support on mac terminal ...
3
votes
1answer
223 views

Cygwin creating multiple links to files inside tar?

I'm trying to create a .tar file in Cygwin: find . > tmpfilelist tar -cf tmp.tar -T tmpfilelist but when I open tmp.tar in Windows with 7-Zip there are four instances of each file: Name ...
3
votes
2answers
85 views

Use all CPUs when creating archives on Linux

Today I wanted to create a backup from a folder on a server with 16 CPUs. I started looking for an option that can utilize my hardware to archive a folder better than how tar does it. Something with ...
3
votes
1answer
440 views

Why /home folder is missing from my backup archive created by tar?

So I'm doing full backup of my VPS using the following command (as root, of course): tar czvf 20120604.tar.gz / Everything seems to be fine, all files seem to appear in the list. The size of ...