LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2014, 08:28 AM   #1
jyunker
Member
 
Registered: Aug 2009
Posts: 167

Rep: Reputation: 0
compressing a tar file


I have a tar file that is 11.5 GB large. I want to copy it to a DVD disk. Therefore at present it is too large. It is a tar file created with the command;:

tar -cf works Desktop

which put all of the files on the desktop (plus subdirectories). Now I do not think it is compressed, so can I use a command to now compress this tar file? if so what is the command.

I could start over creating gzipped tar files from scratch, but these tar files have been checked and approved by our network so that would make it a much longer process, if I went through thta again.

Any help appreciated. Thanks in advance.


Respectfully,


jyunker
 
Old 01-16-2014, 08:40 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 8,488
Blog Entries: 11

Rep: Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386
Code:
man tar
...
-z, --gzip, --ungzip
              filter the archive through gzip
Let us know where you get stuck.
 
Old 01-16-2014, 08:46 AM   #3
jyunker
Member
 
Registered: Aug 2009
Posts: 167

Original Poster
Rep: Reputation: 0
compressing a tar file followup

Okay, what is the difference between zip and gzip? I can use either whiih has the greater compression?

R,

jyunker
 
Old 01-16-2014, 08:49 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,134

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
mite depend on data but i think bzip2 has the greater of compression.
 
Old 01-16-2014, 08:56 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,208

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
If you have the time, you can use 'J' which is 'xz' that has the most compression of all.

http://pokecraft.first-world.info/wi..._vs_LZ4_vs_LZO
 
1 members found this post helpful.
Old 01-16-2014, 09:05 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
@jyunker:

tar jcf -> use bzip2
tar zcf -> use gzip
tar Zcf -> use zip
tar --xz cf -> use xz

Untar: tar xf

When untarring you do not have to specify the compression that is used, tar is smart enough to figure it out.
 
Old 01-16-2014, 09:09 AM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 8,488
Blog Entries: 11

Rep: Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386Reputation: 2386
Quote:
Originally Posted by szboardstretcher View Post
If you have the time, you can use 'J' which is 'xz' that has the most compression of all.
Thanks for that nugget!

The "if you have time" reference means it takes longer than say my usual "tar -pczf"?
 
Old 01-16-2014, 11:26 AM   #8
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
jyunker, unlikely you are able to compress 11.5 GB to fit into DVD (unless all of that is text). In order to compress your TAR file, use "xz":

Code:
xz file.tar
This will take a lot of time. But instead you might want to consider splitting your tar archive to fit it into three DVDs:

Code:
split -b 4500M file.tar file.tar.
This will split "file.tar" into 4500Mb-parts and name them "file.tar.aa", "file.tar.ab", "file.tar.ac" and so on... Don't forget about period in the very end of the command (it will make extension visible for you). Then, in order to assemble files into source one, `cat` them like this:

Code:
cat file.tar.?? > file.tar
 
1 members found this post helpful.
Old 01-16-2014, 12:08 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,133
Blog Entries: 2

Rep: Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839Reputation: 4839
How much you can compress that tar-archive is dependent on its content. If it is mostly text then you will get very good compression rates. If it is images or videos you will likely end with a larger file after compression, since those files usually are already compressed and compressing them again does nothing but adding overhead. But as Mr. Alex already pointed out, splitting the file may be the better option. Also, keep in mind that you can control the level of compression, a xz -9 will use better compression techniques, but will be significantly slower, while a xz -1 will go faster, but result in a larger file.
 
Old 01-16-2014, 01:06 PM   #10
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
By the way, there is a new super fast compression algorithm: http://code.google.com/p/lz4/ .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar compressing in particular directory elerox Linux - Software 3 04-03-2011 08:15 PM
tar is not compressing archive file BajaNick Linux - Software 5 06-16-2007 11:21 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration