Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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:
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???
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
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/
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!
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
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.
Use stdin, stdout to direct information from xz to gzip to file
Code:
xz -d -c in.xz | gzip > out.gz
This causes xz to _d_ecompress to the _c_onsole (stdout), pipe that input to gzip which reads from stdin / writes to stdout if no files and redirect the stdout output to a file. You can add optionally add a "-" option to gzip to specify the console.
The information being piped is in plain tar format. This information was taken from the man pages for xz and gzip and tested.
Posted because I was looking to do the same thing for a Linux initrd on an embedded system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.