LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-24-2018, 11:36 AM   #1
vysero
Member
 
Registered: May 2018
Posts: 137

Rep: Reputation: Disabled
Cool Simple way to convert tar.xz into tar.gz


Is there a simple method of converting a tar.xz into a tar.gz from the terminal? Maybe there is a free application that I can download that someone here is aware of? I would rather not use online converters... not sure why but I dont trust them lol.
 
Old 08-24-2018, 11:42 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,814

Rep: Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772
Quote:
Originally Posted by vysero View Post
Is there a simple method of converting a tar.xz into a tar.gz from the terminal? Maybe there is a free application that I can download that someone here is aware of? I would rather not use online converters... not sure why but I dont trust them lol.
Is there some reason you don't just run "xz -d <file>.tar.gz && gzip *.tar"? Or just uncompress the file, and re-compress it with "tar xvfz"???
 
Old 08-24-2018, 12:01 PM   #3
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Is there some reason you don't just run "xz -d <file>.tar.gz && gzip *.tar"? Or just uncompress the file, and re-compress it with "tar xvfz"???
Well I am working with a make file designed to unpack .gz files and my C/Makefile skills are almost non-existent.
 
Old 08-24-2018, 12:21 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,997
Blog Entries: 13

Rep: Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445
Quote:
Originally Posted by vysero View Post
Well I am working with a make file designed to unpack .gz files and my C/Makefile skills are almost non-existent.
This makes no sense.


tar does not need any flags to create the proper zipped file type, it will detect based on the filename extension.


tar will not block you for different file types, it will contend with the files based on their extensions.


What I mean is/are:
Code:
To Create:
$ tar cvf new-filename.tar.bz2 [list of files]
This creates a tar with the bz2 extension and does the compression properly
Code:
To Extract:
$ tar xvf filename.tar.gz
$ tar xvf filename.tar.bz2
These extract those various tar file names with no special flags or actions done in advance of calling the tar command.  No need to unzip in advance
Recommend you just use the tar command in your Makefile.
 
Old 08-24-2018, 12:30 PM   #5
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
I mean if you dont know the answer to the question that's fine. Anyone else know?
 
Old 08-24-2018, 12:35 PM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,997
Blog Entries: 13

Rep: Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445
Why doesn't the command suggested by TB0ne work for you? Have you not tried it? Or better yet, if you've tried and it doesn't work, what is the continued problem?
Quote:
Originally Posted by TB0ne View Post
Is there some reason you don't just run "xz -d <file>.tar.gz && gzip *.tar"? Or just uncompress the file, and re-compress it with "tar xvfz"???
We most certainly know plenty of things, please try not be taunt other users, we don't know exactly what you're trying to do.
Quote:
Originally Posted by vysero View Post
I mean if you dont know the answer to the question that's fine. Anyone else know?
And also realize that there are many different ways to do the same thing.
Quote:
Originally Posted by vysero View Post
Well I am working with a make file designed to unpack .gz files and my C/Makefile skills are almost non-existent.
Perhaps you ought to be more direct and post representative code from your Makefile, and then say exactly something like, "I have <this> and I need it to be converted to <that>"

Once again, tar will unpack gz files, why don't you try it?

Perhaps where you can benefit from is a description about how to include a call to tar from within your Makefile. Because that is exactly what can be done.

Last edited by rtmistler; 08-24-2018 at 12:39 PM.
 
Old 08-24-2018, 12:39 PM   #7
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
That's the problem. Why are we wasting time trying to figure out my motivations for wanting to convert a file type? All I want to know is if there is a simple command, method or application for converting a tar.gz into a tar.xz.
 
Old 08-24-2018, 12:41 PM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,997
Blog Entries: 13

Rep: Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445
Quote:
Originally Posted by vysero View Post
That's the problem. Why are we wasting time trying to figure out my motivations for wanting to convert a file type? All I want to know is if there is a simple command, method or application for converting a tar.gz into a tar.xz.
OK, sorry for wasting your time.


There is no one, simple command.


There is no application which will do this in one call.


The only method I know of is exactly what TB0ne suggested.

Last edited by rtmistler; 08-24-2018 at 12:44 PM.
 
Old 08-24-2018, 12:43 PM   #9
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 12,990

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
in general it is a two-step process.
1. uncompress gz (or xz) - to create a tar
2. compress tar with gzip or xz or whatever you wish.

gz can be created by gzip and uncompressed by gunzip (or gzip -d) - see man page about usage
xz - again see man page about usage
 
Old 08-24-2018, 12:44 PM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,814

Rep: Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772Reputation: 5772
Quote:
Originally Posted by vysero View Post
I mean if you dont know the answer to the question that's fine. Anyone else know?
You were given the answer. And as was said...your post makes no sense, in the context in which you framed it. You said:
Quote:
Originally Posted by vysero
Well I am working with a make file designed to unpack .gz files and my C/Makefile skills are almost non-existent.
...indicating you're developing/deploying software, you have some knowledge of C/Makefile, and you ALREADY know how to unpack a .gz file. Seems very odd, then, that you can't use another command, read a man page on the xz, gzip, or tar commands. Specifically, "tar -cJF", which extracts a .tar.xz file, providing you have the xz-utils installed.

We don't know your skill level, or what you've done/tried unless you tell us and provide details. You asked a question, and I gave you an exact answer. Whether you know how to use it past that point is unknown.
 
Old 08-24-2018, 12:44 PM   #11
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
in general it is a two-step process.
1. uncompress gz (or xz) - to create a tar
2. compress tar with gzip or xz or whatever you wish.

gz can be created by gzip and uncompressed by gunzip (or gzip -d) - see man page about usage
xz - again see man page about usage
He didn't suggest a method for changing the file types. He suggested a method for unpacking tar files.
 
Old 08-24-2018, 12:48 PM   #12
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,997
Blog Entries: 13

Rep: Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445Reputation: 3445
Quote:
Originally Posted by vysero View Post
He didn't suggest a method for changing the file types. He suggested a method for unpacking tar files.
No offense but you sound as if you're objecting merely for the sake of raising an objection.


There is no known method to directly convert.


Since you seem to be developing code, perhaps you can write some which will fulfill this functional need you have and then you can share that as a contribution for the community at large.


Sorry, but at present the only way to perform what you wish to accomplish would be to extract the files from the first file and then repack them into a newly created archive file of your desired format.
 
1 members found this post helpful.
Old 08-24-2018, 12:49 PM   #13
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
in general it is a two-step process.
1. uncompress gz (or xz) - to create a tar
2. compress tar with gzip or xz or whatever you wish.

gz can be created by gzip and uncompressed by gunzip (or gzip -d) - see man page about usage
xz - again see man page about usage
Ah I see, are you aware of any applications out there which I can just upload a tar.gz and it will output a tar.xz for me?
 
Old 08-24-2018, 12:51 PM   #14
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 12,990

Rep: Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095Reputation: 4095
no, but you can implement a tool (shell script) in 5 minutes yourself.
 
Old 08-24-2018, 12:53 PM   #15
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
no, but you can implement a tool (shell script) in 5 minutes yourself.
I have never written a shell script lol so I doubt that. How might I go about it?
 
  


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 tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
"Invalid tar magic" error msg. when I try to tar ldmud *.tar file in DSL pixxi451 Linux - Newbie 4 07-04-2010 08:32 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM

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

All times are GMT -5. The time now is 04:15 AM.

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