Tar unpack zip
As a matter of fact, my Linux system doesn't even have a zip utility, but only unzip leaving me to wonder why this is the main recommended option. Of course unzip worked, solving my problem, but why can't tar extract zip files? Perhaps I should instead be asking, what is the difference between zip and the compression methods supported by tar? The UNIX philosophy is to have small tools.
One tool is doing exactly one thing, but this especially well. The tar tool is just combining several files into a single file without any compression. The zip tool is a completely different thing. It takes a bunch of files and combines them into a single compressed file.
With totally different algorithms. If you want one tool to rule them all use atool. It will support a whole bunch of different formats simply by detecting the format and calling the correct tool.
Since people not only wanted to archive their files, but also, compress them, so they just pipe the tar output through any compressor that accepts data stream input and drops the results to a file. Now, to make such task a painless as possible, tar decided to pipe internally the files generated to compression tools, like gzip, lzma, etc. That's why when you try to extract a corrupted file through tar you are shown the underlying tool error, instead of tar 's:.
So, it isn't that tar doesn't uncompress zip files, just that tar doesn't have the ability to pipe it through the correct tool, since nobody actually bothered to implement it, and zip already accomplish the file archive function of the tar file format there's less reason for tar to support it. If you don't have them, the tool will fail. A tar file is a file format in itself designed for tape archives. This format can then be compressed using for example gzip or bzip2 compression formats.
When you extract a compressed tar file, you effectively uncompress it, then extract the original files from the uncompressed tar file. When you extract a zip file there is no tar file within it, just all your original files. Therefore there is no reason for tar to be involved in the process at all. You can also compress files using gzip or bzip2 by themselves just like you can create zip files with no tar involved. When you uncompress these files, you use gunzip or bunzip2 and not tar.
As the answer "Some things just are and we should accept them" does not sit well with me either, I just did some digging always good to learn something new isn't it? I suppose that tar could have built in zip support, but the methodologies are apparently fundamentally different. This ensures that your backup remains unaffected and the files don't corrupt if anything breaks on your system.
The c , v , z , and f flags used in the aforementioned command stand for Create , Verbose , gzip , and Filename. GZ archives is by using 7-Zip.
The basic syntax of creating a TAR file with 7-Zip is:. GZ files. It's a two-step process. If you already have a TAR file and want to compress it using 7-Zip, use the following command format:. The aforementioned command takes the archive. The output is the archive. The -so and -si flags denote Standard Output and Standard Input.
The first part of the command writes the archive. The second command reads the archive. Most of the time, you will get your hands on a compressed package that needs extracting. On Linux, there are multiple ways to unzip compressed archives. The collective -xvzf flag stands for Extract , Verbose , gzip , and Filename respectively. Anything that follows the -f option is treated as the input file. Note that if you are working with TAR files, you can remove the -z flag from the commands.
The aforementioned command will extract the archive. You can choose which files to extract from the archive. On many Linux-like operating systems the command line tools for working with TAR, GZIP, BZIP and ZIP files are already installed, so you almost certainly don't need to install anything, but if you are running a minimal installation of your OS or if you've removed the tools in the past, follow the directions below to install what you need.
Select the tab for the OS you are running:. The directions below assume you are running as the root user. If you are running as an another user, you may need to prepend the commands with sudo. The base repositories for these OSes have the packages we need. Execute the following command:. The base repositories for these operating systems have the packages we need.
Once the terminal is open, you will be able to follow the rest of the directions in this article.
0コメント