

Finally Documents is the directory to archive and compress.
#Linux unzip zip file zip file#
The unzip command in CentOS will unzip the zip file to the current working. tgz file extension, others will know that this is a tar archive that has been gzipped. To unzip a zip folder, use the unzip command followed by the name of the zip file. There are several methods of archiving files and retrieving archives in Unix-like systems like Linux. The new archive must be named, which is Documents.tgz in this example. The -czvf options break down as c for create a new archive, z for compress with g zip, v for verbose output, and f for file equals archive, which means the archive maintains the file structure of the original directory. Zip Files in Linux Terminal With Tar and GzipĮnter the command tar -czvf Documents.tgz Documents. Using tar with the gzip option on the directory compresses everything and makes one archive. (The complete size of the encryped compressed data stream for zipfile entries is reported by the more verbose zipinfo(1L) reports, see the separate manual.). Using the other zip methods on a directory of files, you’d get a compressed archive for each file in the directory. You get a nicely compressed single package of files. Whatever the file sizes are, the size of the tar file will be about the same.īut if you combine a zip method with tar, then you get something really cool. Decompressing a File To decompress a GZ archive file, use the -d (decompress) option. This time the original ODS file is retained. gzip -k calc-sheet.ods ls -lh calc-sheet.

But if you prefer to retain the original file, you can use the -k (keep) option. So, first, combine the split archive to a single archive: zip -s 0 split-foo.zip -out unsplit-foo.zip. A split archive can also be converted into a single-file archive using a split size of 0: zip -s 0 test.zip -O single.zip. Why hasn’t tar been mentioned yet? It’s an archiving tool, taking a bunch of files and putting them into one archive for easy transport. If you need the original file you can retrieve it from the archive file. That is what the -s 0 flag means in the manual. What About Tar to Zip and Unzip Files in Linux?
