LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 03-12-2010, 11:47 AM   #1
Katie59
LQ Newbie
 
Registered: Feb 2010
Posts: 6

Rep: Reputation: 0
Turn a .tar file into a .tar.gz?


This has probably been asked before and if it has, I'm sorry, I just don't have time to search for it right now.

I have a bunch of times that are in .tar format, and need to be made into .tar.gz. How do I do that? I really don't want to go through and manually compress each and every one, because there's a lot of them!

Thanks as always for your help
 
Old 03-12-2010, 11:50 AM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Code:
gzip *.tar
 
Old 03-12-2010, 11:59 AM   #3
Katie59
LQ Newbie
 
Registered: Feb 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Wow, yea, I really should have been able to figure that out on my own.

*blush*

Thanks!
 
Old 03-12-2010, 02:35 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
also consider creating tarballs in one blow:
Code:
tar -cvjf dir-name dir-name.tar.bz2 # to compress
tar -xvjf dir-name.tar.bz2 # to extract
 
Old 03-12-2010, 02:49 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by schneidz View Post
also consider creating tarballs in one blow:
Code:
tar -cvjf dir-name dir-name.tar.bz2 # to compress
tar -xvjf dir-name.tar.bz2 # to extract
Replace 'j' with 'z' for gzip instead of bzip2.

Also with newer versions of tar you do not need to specify 'j' or 'z' when extracting, it automatically detects it and runs gunzip or bunzip automatically.
 
  


Reply



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
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
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
problem unzipping a tar.bz2 file tar: Error is not recov jyome Linux - Software 4 09-04-2003 01:04 PM

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

All times are GMT -5. The time now is 12:11 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
Open Source Consulting | Domain Registration