If a particular archive type has to be converted into another format (eg - tar.gz to zip), then one can open the archive using file-roller and go to -

Archive -> Save As -> (select the extension) -> Save

Also, in this method, Other Options can be used to set a password for the zip file, which is not possible in case of tar.gz files using file-roller.

How can the above steps be performed using the command line?

2 Answers 2


Basic Shell commands:

$ cd $HOME
$ mkdir tempdir
$ cd tempdir
$ tar -zxvf ../archive.tar.gz 

At this point you have a copy of the contents of archive.tar.gz in $HOME/tempdir/

$ zip -rmp password ../archive.zip *

... will create a zip archive from the contents of tempdir/ and then remove the files added. I presume it still does; use standard (weak) PKZip 2.0 encryption as stated for the -e option - which doesn't take the password, but prompts for it instead.

Make SURE / VERIFY you're still in tempdir/

$ pwd

If there is ANYTHING else than "/tempdir" at the end above,
then DO NOT continue with what comes next, here:

$ rm -rf *  
$ cd ..
$ rmdir tempdir

All the above might be possible with a pipe too, as in:

$ tar -zxvf ./archive.tar.gz - | zip -p password - ./archive.zip 

... I see no reason to try it out though - due to the weak encryption and possible problems with how zip handles special files, links and whatnot.

If you want real encryption, look into gnupg and related utilities instead.

man tar, man zip, zip --help, zip -h2 | less, tar --help | less may hold information vital to the above, especially the piped conversion which I have not tried.


You can use tar-to-zip for this purpose. All you need to do is:

Install node.js with nvm if you do not have it.

And then install tar-to-zip with:

npm i tar-to-zip -g

And use it with:

tar2zip hello.tar.gz

It will show percents of operation progress and create file hello.zip in the same directory.

Pipes could be used as well:

cat hello.tar.gz | tar2zip > hello.zip

Unfortunately there is no way to set a password.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .