LinuxQuestions.org
Visit Jeremy's Blog.
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, 12:58 PM   #16
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,098

Rep: Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142

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.
Can you explain the difference?

In linux actually there is no file type just file name. If you wish to rename the file (so file.tar.gz should be renamed to file.tar.xz - or something similar) just use the command:
Code:
mv original_name new_name
But I'm confused now what do you mean by file type and what do you really want to achieve.

Last edited by pan64; 08-24-2018 at 01:00 PM.
 
Old 08-24-2018, 12:58 PM   #17
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,805

Rep: Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280Reputation: 1280
Quote:
Originally Posted by vysero View Post
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?
Write a script that
takes the name of the tar.gz file,
uncompresses it
compresses it with xz
(see commands earlier in this thread)

Note that you will have to consider what to do with the original file as well as manage the uncompressed content that will be left lying about.

You already said you didn't want to use on-line tools (which I agree with)...although there seem to be lots of those.
They probably just do what I'm suggesting with python or perl
 
Old 08-24-2018, 01:03 PM   #18
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,054
Blog Entries: 13

Rep: Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501
Quote:
Originally Posted by vysero View Post
I have never written a shell script lol so I doubt that. How might I go about it?
See the My Bash Blog link in my signature.


See the Bash Script Tutorial link in TB0ne's signature.


A key excerpt from my blog:
Quote:
"Whatever you can type on a command line, you can write in a script."
We're happy to help, but LQ members are not here to just emit programs and scripts for you. The primary reasons there are that people won't know your exact requirements. Once you've started to write a script, feel free to post it and members will be happy to offer suggestions. But just a quick example, the following script will run the ls command and cat out a file, and hopefully illustrate how simple it can be to write a bash script:
Code:
#/bin/sh
ls
cat example.txt
 
Old 08-24-2018, 01:06 PM   #19
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"???

Apparently this is the answer? My ignorance alone should tip you off to my skill level here. I have no idea what xz -d <file>.tar.gz && gzip *.tar does. I like the idea of uncompressing it and re-compressing it with a different extension. Is there a simple tool I can use to compress files into a specific format? I mean this is the Linux Newbie forums right?? I posted this in the right forums right???
 
Old 08-24-2018, 01:11 PM   #20
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,098

Rep: Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142
yes, that is one possible answer.
 
Old 08-24-2018, 01:13 PM   #21
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,054
Blog Entries: 13

Rep: Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501
Quote:
Originally Posted by vysero View Post
Apparently this is the answer? My ignorance alone should tip you off to my skill level here. I have no idea what xz -d <file>.tar.gz && gzip *.tar does. I like the idea of uncompressing it and re-compressing it with a different extension. Is there a simple tool I can use to compress files into a specific format? I mean this is the Linux Newbie forums right?? I posted this in the right forums right???
You have absolutely asked in the correct forum.


You should read and research all the details about the commands offered to you in post #2


You should also be aware that there is a similar recommendation, using a different command in post #4


There are descriptions of this process in post #9


To aid in all of this, you should read manual pages for all of the relevant commands.


A secondary way to view manual pages is not to review them from your Linux system (we tend to find that many people ether do not know how, or are uncomfortable using the man page command), you can search for and view man pages on the web, here's one of my favorite sites for that: https://linux.die.net/
 
Old 08-24-2018, 02:28 PM   #22
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Well I dont want to break anything here. What does this xz -d <file>.tar.gz && gzip *.tar do exactly?
 
Old 08-24-2018, 02:30 PM   #23
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,098

Rep: Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142Reputation: 4142
Code:
xz -d <file>.tar.gz   uncompress a file
&&                    logical operator, will execute the second command only if the first was successful
gzip *.tar            compress a file
you need to replace <file>, use the real file name here
 
Old 08-24-2018, 02:46 PM   #24
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,054
Blog Entries: 13

Rep: Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501Reputation: 3501
And that is just a continued typo for the recommended command. The file where the xz -d command would be applied against would have a .xz extension.

It should have said:

"xz -d <file>.tar.xz && gzip <file>.tar"
 
1 members found this post helpful.
Old 08-24-2018, 02:56 PM   #25
vysero
Member
 
Registered: May 2018
Posts: 137

Original Poster
Rep: Reputation: Disabled
Dag-nabbit TBone this is exactly what I wanted but you completely threw me off by asking "Is there some reason you don't just run x". Of course answering a question with a question can sometimes be a maieutic method but in this case it was less Socratic and more confusing lol thanks guys!
 
Old 08-24-2018, 02:57 PM   #26
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 21,960

Rep: Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827Reputation: 5827
Quote:
Originally Posted by vysero View Post
Apparently this is the answer? My ignorance alone should tip you off to my skill level here. I have no idea what xz -d <file>.tar.gz && gzip *.tar does. I like the idea of uncompressing it and re-compressing it with a different extension. Is there a simple tool I can use to compress files into a specific format? I mean this is the Linux Newbie forums right?? I posted this in the right forums right???
That command **DOES EXACTLY WHAT YOU ASKED FOR**

It takes a .tar.xz file and 'converts' it into a tar.gz file from the command line. You asked; I answered, and it's now two pages of comments about how we don't understand the question, or if there's a utility/script/'online tool' to do this.

rtmistler is right, and there was a typo in my command, but a VERY obvious one; instead of .gz, you would put .xz. AGAIN:
Code:
xz -d <filename>.tar.xz && gzip *.tar
If you want to know what it does, then type in "man xz", "man gzip", and "man tar" to know what those commands do.
Quote:
Originally Posted by vysero View Post
Dag-nabbit TBone this is exactly what I wanted but you completely threw me off by asking "Is there some reason you don't just run x". Of course answering a question with a question can sometimes be a maieutic method but in this case it was less Socratic and more confusing lol thanks guys!
So instead of reading it and thinking about what it said, you kept asking? Sorry...answer was VERY clear, and you were even pointed to it a couple of times in the thread by others.

Last edited by TB0ne; 08-25-2018 at 09:25 AM.
 
  


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 01:05 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