$ tar tvf archive_name.tar View the *.tar.gz file content without extracting using option tvzf You can view the *.tar file content before extracting as shown below. Listing an archive using tar command View the tar archive file content without extracting using option tvf ![]() Note: In all the above commands v is optional, which lists the file being processed. Use the option j for uncompressing a bzip2 tar archive. ![]() $ tar xvfz archive_ Extracting a bzipped tar archive ( *.tar.bz2 ) using option xvjf Use the option z for uncompressing a gzip tar archive. Extracting (untar) an archive using tar command Extract a *.tar file using option xvfĮxtract a tar file using option x as shown below: $ tar xvf archive_name.tarĮxtract a gzipped tar archive ( *.tar.gz ) using option xvzf Gzip vs bzip2: bzip2 takes more time to compress and decompress than gzip. i.e cvf for archive creation, cvfz for compressed gzip archive creation, cvfj for compressed bzip2 archive creation etc., For this method to work properly, don’t give – in front of the options.Ĭreating a bzipped tar archive using option cvjfĬreate a bzip2 tar archive as shown below: $ tar cvfj archive_2 dirname/ Note: I like to keep the ‘cvf’ (or tvf, or xvf) option unchanged for all archive creation (or view, or extract) and add additional option at the end, which is easier to remember. To use a gzip compression on the tar archive, use the z option as shown below. The above tar cvf option, does not provide any compression. v – verbosely list files which are processed.Ĭreating a tar gzipped archive using option cvzf.This is the basic command to create a tar archive. Creating an archive using tar command Creating an uncompressed tar archive using option cvf In this article, let us review various tar examples including how to create tar archives (with gzip and bzip compression), extract a single file or directory, view tar archive contents, validate the integrity of tar archives, finding out the difference between tar archive and file system, estimate the size of the tar archives before creating it etc.,ġ. Understanding various tar command options will help you master the archive file manipulation. It's worth noting that everything in this article also works on the Windows Subsystem for Linux, which allows you to install the Bash shell inside of Windows 10 or Windows 11, although there are other ways to open tar.gz files on Windows as well.On Unix platform, tar command is the primary archiving utility. You just need to use the appropriate tar command line options. ![]() bz2 extension suffix indicates that the archive has been compressed, using either the gzipĬompression algorithm. The tar command will work happily with both types of file, so it doesn't matter which compression method was used-and it should be available everywhere you have a Bash shell. Someone somewhere is probably still using tar with tape. Forty years later we are still using the tar command to extract tar files on to our hard drives. Tar files date all the way back to 1979 when the tar command was created to allow system administrators to archive files onto tape. Portion of the file extension stands for tape archive, and is the reason that both of these file types are called tar files. Extension is uncompressed, but those will be very rare.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |