top of page
glycakluperloa

Unzip tar tar file like a pro with this tutorial



A tar.gz file contains several compressed files to save storage space, as well as bandwidth during the downloading process. The .tar file acts as a portable container for other files and is sometimes called a tarball. The .gz part of the extension, stands for gzip, a commonly-used compression utility.




how to unzip tar tar file




Note: Some graphical interfaces include a tool for managing tar.gz files without the command-line. Simply right-click the item you want to compress, mouseover compress, and choose tar.gz. You can also right-click a tar.gz file, mouseover extract, and select an option to unpack the archive.


if(typeof ez_ad_units != 'undefined')ez_ad_units.push([[728,90],'linuxize_com-box-2','ezslot_7',167,'0','0']);__ez_fad_position('div-gpt-ad-linuxize_com-box-2-0');The tar command creates tar files by converting a group of files into an archive. It also can extract tar archives, display a list of the files included in the archive, add additional files to an existing archive, and various other kinds of operations.


Tar supports a vast range of compression programs such as gzip, bzip2, lzip, lzma, lzop, xz and compress. When creating compressed tar archives, it is an accepted convention to append the compressor suffix to the archive file name. For example, if an archive has been compressed with gzip, it should be named archive.tar.gz.if(typeof ez_ad_units != 'undefined')ez_ad_units.push([[300,250],'linuxize_com-medrectangle-3','ezslot_2',140,'0','0']);__ez_fad_position('div-gpt-ad-linuxize_com-medrectangle-3-0');


Another popular algorithm for compressing tar files is bzip2. When using bzip2, the archive name should end with either tar.bz2 or tbz.if(typeof ez_ad_units != 'undefined')ez_ad_units.push([[580,400],'linuxize_com-box-4','ezslot_4',143,'0','0']);__ez_fad_position('div-gpt-ad-linuxize_com-box-4-0');


if(typeof ez_ad_units != 'undefined')ez_ad_units.push([[728,90],'linuxize_com-banner-1','ezslot_6',161,'0','0']);__ez_fad_position('div-gpt-ad-linuxize_com-banner-1-0');To compress the archive with the bzip2 algorithm, invoke tar with the -j option. The following command creates a tar.bz2 archive from the given files:


Most of the archived files in Linux are archived and compressed using a tar or tar.gz format. Knowing how to extract these files from the command line is important.if(typeof ez_ad_units != 'undefined')ez_ad_units.push([[728,90],'linuxize_com-large-mobile-banner-1','ezslot_5',157,'0','0']);__ez_fad_position('div-gpt-ad-linuxize_com-large-mobile-banner-1-0');


The most common uses of the tar command are to create and extract a tar archive. To extract an archive, use the tar -xf command followed by the archive name, and to create a new one use tar -czf followed by the archive name and the files and directories you want to add to the archive.


If using a version of Windows without inbuilt support for .zip files, you will need to download a zip file extractor such as JustZIPIt or the Info-ZIP tools. Refer to the documentation provided with whichever program you choose for further instructions.


The tarfile module makes it possible to read and write tararchives, including those using gzip, bz2 and lzma compression.Use the zipfile module to read or write .zip files, or thehigher-level functions in shutil.


handles directories, regular files, hardlinks, symbolic links, fifos,character devices and block devices and is able to acquire and restore fileinformation like timestamp, access permissions and owner.


Note that 'a:gz', 'a:bz2' or 'a:xz' is not possible. If modeis not suitable to open a certain (compressed) file for reading,ReadError is raised. Use mode 'r' to avoid this. If acompression method is not supported, CompressionError is raised.


For special purposes, there is a second format for mode:'filemode[compression]'. tarfile.open() will return a TarFileobject that processes its data as a stream of blocks. No random seeking willbe done on the file. If given, fileobj may be any object that has aread() or write() method (depending on the mode). bufsizespecifies the blocksize and defaults to 20 * 512 bytes. Use this variantin combination with e.g. sys.stdin, a socket file object or a tapedevice. However, such a TarFile object is limited in that it doesnot allow random access, see Examples. The currentlypossible modes:


The TarFile object provides an interface to a tar archive. A tararchive is a sequence of blocks. An archive member (a stored file) is made up ofa header block followed by data blocks. It is possible to store a file in a tararchive several times. Each archive member is represented by a TarInfoobject, see TarInfo Objects for details.


A TarFile object can be used as a context manager in a withstatement. It will automatically be closed when the block is completed. Pleasenote that in the event of an exception an archive opened for writing will notbe finalized; only the internally used file object will be closed. See theExamples section for a use case.


mode is either 'r' to read from an existing archive, 'a' to appenddata to an existing file, 'w' to create a new file overwriting an existingone, or 'x' to create a new file only if it does not already exist.


Never extract archives from untrusted sources without prior inspection.It is possible that files are created outside of path, e.g. membersthat have absolute filenames starting with "/" or filenames with twodots "..".


Extract a member from the archive to the current working directory, using itsfull name. Its file information is extracted as accurately as possible. membermay be a filename or a TarInfo object. You can specify a differentdirectory using path. path may be a path-like object.File attributes (owner, mtime, mode) are set unless set_attrs is false.


Extract a member from the archive as a file object. member may bea filename or a TarInfo object. If member is a regular file ora link, an io.BufferedReader object is returned. For all otherexisting members, None is returned. If member does not appearin the archive, KeyError is raised.


Add the file name to the archive. name may be any type of file(directory, fifo, symbolic link, etc.). If given, arcname specifies analternative name for the file in the archive. Directories are addedrecursively by default. This can be avoided by setting recursive toFalse. Recursion adds entries in sorted order.If filter is given, itshould be a function that takes a TarInfo object argument andreturns the changed TarInfo object. If it instead returnsNone the TarInfo object will be excluded from thearchive. See Examples for an example.


Add the TarInfo object tarinfo to the archive. If fileobj is given,it should be a binary file, andtarinfo.size bytes are read from it and added to the archive. You cancreate TarInfo objects directly, or by using gettarinfo().


The POSIX.1-1988 ustar format (USTAR_FORMAT). It supports filenamesup to a length of at best 256 characters and linknames up to 100 characters.The maximum file size is 8 GiB. This is an old and limited but widelysupported format.


The GNU tar format (GNU_FORMAT). It supports long filenames andlinknames, files bigger than 8 GiB and sparse files. It is the de factostandard on GNU/Linux systems. tarfile fully supports the GNU tarextensions for long names, sparse file support is read-only.


The POSIX.1-2001 pax format (PAX_FORMAT). It is the most flexibleformat with virtually no limits. It supports long filenames and linknames, largefiles and stores pathnames in a portable way. Modern tar implementations,including GNU tar, bsdtar/libarchive and star, fully support extended paxfeatures; some old or unmaintained libraries may not, but should treatpax archives as if they were in the universally supported ustar format.It is the current default format for new archives.


It extends the existing ustar format with extra headers for informationthat cannot be stored otherwise. There are two flavours of pax headers:Extended headers only affect the subsequent file header, globalheaders are valid for the complete archive and affect all following files.All the data in a pax header is encoded in UTF-8 for portability reasons.


The ancient V7 format. This is the first tar format from Unix Seventh Edition,storing only regular files and directories. Names must not be longer than 100characters, there is no user/group name information. Some archives havemiscalculated header checksums in case of fields with non-ASCII characters.


The tar format was originally conceived to make backups on tape drives with themain focus on preserving file system information. Nowadays tar archives arecommonly used for file distribution and exchanging archives over networks. Oneproblem of the original format (which is the basis of all other formats) isthat there is no concept of supporting different character encodings. Forexample, an ordinary tar archive created on a UTF-8 system cannot be readcorrectly on a Latin-1 system if it contains non-ASCII characters. Textualmetadata (like filenames, linknames, user/group names) will appear damaged.Unfortunately, there is no way to autodetect the encoding of an archive. Thepax format was designed to solve this problem. It stores non-ASCII metadatausing the universal character encoding UTF-8.


encoding defines the character encoding to use for the metadata in thearchive. The default value is sys.getfilesystemencoding() or 'ascii'as a fallback. Depending on whether the archive is read or written, themetadata must be either decoded or encoded. If encoding is not setappropriately, this conversion may fail.


The errors argument defines how characters are treated that cannot beconverted. Possible values are listed in section Error Handlers.The default scheme is 'surrogateescape' which Python also uses for itsfile system calls, see File Names, Command Line Arguments, and Environment Variables.


I received a huge .tar.gz file from a client that contains about 800 mb of image files (when uncompressed.) Our hosting company's ftp is seriously slow, so extracting all the files locally and sending them up via ftp isn't practical. I was able to ftp the .tar.gz file to our hosting site, but when I ssh into my directory and try using unzip, it gives me this error: 2ff7e9595c


2 views0 comments

Recent Posts

See All

Dólar alışı və satışı

Dólar alışı vе satışı: Nеyе diqqеt еtmеk lazımdır? Dólar alışı vе satışı, xarici ölkеlеrе s Dólar alışı vе satışı, xarici ölkеlеrе...

Comments


bottom of page