Questions tagged [tar]

An archiving program for storing and retrieving files as a collection with support for data compression.

An archiving program for storing and retrieving files as a collection with support for data compression. It is mainly used for compacting multiple files into single one, for easy transporting or compression.

Its name comes from Tape ARchive

2382 questions
907
votes
28 answers

Shell command to tar directory excluding certain files/folders

Is there a simple shell command/script that supports excluding certain files/folders from being archived? I have a directory that need to be archived with a sub directory that has a number of very large files I do not need to backup. Not quite…
deepwell
  • 17,897
  • 10
  • 31
  • 37
415
votes
20 answers

How do I tar a directory of files and folders without including the directory itself?

I typically do: tar -czvf my_directory.tar.gz my_directory What if I just want to include everything (including any hidden system files) in my_directory, but not the directory itself? I don't want: my_directory --- my_file --- my_file ---…
user4903
350
votes
9 answers

Tar a directory, but don't store full absolute paths in the archive

I have the following command in the part of a backup shell script: tar -cjf site1.bz2 /var/www/site1/ When I list the contents of the archive, I get: tar -tf…
QuentinC
  • 7,473
  • 3
  • 16
  • 28
278
votes
4 answers

How to uncompress a tar.gz in another directory

I have an archive *.tar.gz How can I uncompress this in a destination directory?
Mercer
  • 9,298
  • 27
  • 91
  • 154
255
votes
6 answers

Utilizing multi core for tar+gzip/bzip compression/decompression

I normally compress using tar zcvf and decompress using tar zxvf (using gzip due to habit). I've recently gotten a quad core CPU with hyperthreading, so I have 8 logical cores, and I notice that many of the cores are unused during…
user1118764
  • 7,817
  • 15
  • 54
  • 94
194
votes
1 answer

What is the difference between tar and zip?

What is the difference between tar and zip? What are the use cases for each?
mtk
  • 11,504
  • 15
  • 67
  • 104
187
votes
6 answers

Tar archiving that takes input from a list of files

I have a file that contain list of files I want to archive with tar. Let's call it mylist.txt It contains: file1.txt file2.txt ... file10.txt Is there a way I can issue TAR command that takes mylist.txt as input? Something like tar -cvf…
neversaint
  • 50,277
  • 118
  • 274
  • 437
184
votes
5 answers

Create a tar.xz in one command

I am trying to create a .tar.xz compressed archive in one command. What is the specific syntax for that? I have tried tar cf - file | xz file.tar.xz, but that does not work.
George K.
  • 2,479
  • 4
  • 17
  • 27
131
votes
4 answers

Are tar.gz and tgz the same thing?

I created .tgz file with tar czvf file command.then I ended up with a tgz file. I want to know the difference between it and tar.gz.
mko
  • 19,044
  • 43
  • 119
  • 183
127
votes
10 answers

Excluding directory when creating a .tar.gz file

I have a /public_html/ folder, in that folder there's a /tmp/ folder that has like 70gb of files I don't really need. Now I am trying to create a .tar.gz of /public_html/ excluding /tmp/ This is the command I ran: tar -pczf MyBackup.tar.gz…
suresh
  • 1,273
  • 2
  • 9
  • 4
122
votes
8 answers

How to extract filename.tar.gz file

I want to extract an archive named filename.tar.gz. Using tar -xzvf filename.tar.gz doesn't extract the file. it is gives this error: gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error exit delayed from previous errors
Kabir
  • 2,026
  • 4
  • 18
  • 24
119
votes
8 answers

How to check if a Unix .tar.gz file is a valid file without uncompressing?

I have found the question How to determine if data is valid tar file without a file?, but I was wondering: is there a ready made command line solution?
understack
  • 10,311
  • 23
  • 72
  • 97
115
votes
10 answers

Find files and tar them (with spaces)

Alright, so simple problem here. I'm working on a simple back up code. It works fine except if the files have spaces in them. This is how I'm finding files and adding them to a tar archive: find . -type f | xargs tar -czvf backup.tar.gz The…
Caleb Kester
  • 1,570
  • 2
  • 13
  • 15
95
votes
16 answers

tar: add all files and directories in current directory INCLUDING .svn and so on

I try to tar.gz a directory and use tar -czf workspace.tar.gz * The resulting tar includes .svn directories in subdirs but NOT in the current directory (as * gets expanded to only 'visible' files before it is passed to tar I tried to tar -czf…
Micha
  • 951
  • 1
  • 6
  • 3
93
votes
2 answers

Create a .tar.bz2 file Linux

On my Linux machine, I wish to create a .tar.bz2 file of a certain folder. Once I place myself in that folder (in the terminal), what do I type in the terminal command line to place the compressed folder in the home directory of my machine? Let's…
Adam
  • 1,697
  • 3
  • 19
  • 30
1
2 3
99 100