![]() The following command creates a tar.bz2 archive from the given files: tar -cjf 2 file1 file2 Listing Tar Archives # To compress the archive with the bzip2 algorithm, invoke tar with the -j option. When using bzip2, the archive name should end with either tar.bz2 or tbz. For example, to create a tar.gzĪrchive from given files, you would run the following command: tar -czf file1 file2 Creating Tar Bz2 Archive #Īnother popular algorithm for compressing tar files is bzip2. The -z option tells tar to compress the archive using the gzip algorithm as it is created. When compressing tar archives with gzip, the archive name should end with either tar.gz or tgz. ![]() Gzip is the most popular algorithm for compressing tar files. ![]() Use the -v option if you want to see the files that are being processed. The following example will create an archive named user_backup.tar of the /home/user directory: tar -cf backup.tar /home/user ![]() By default, directories are archived recursively unless -no-recursion option is specified. You can create archives from the contents of one or more directories or files. Here is the equivalent command using the long-form options: tar -create -file=archive.tar file1 file2 file3 To create a tar archive, use the -c option followed by -f and the name of the archive.įor example, to create an archive named archive.tar from the files named file1, file2, file3, you would run the following command: tar -cf archive.tar file1 file2 file3 For example, if an archive has been compressed with gzip When creating compressed tar archives, it is an accepted convention to append the compressor suffix to the archive file name. Tar supports a vast range of compression programs such as gzip, bzip2, lzip, lzma, lzop, xz and compress. The short-form options are prefixed with a single dash ( -), which can be omitted. The long-form options are prefixed with a double dash ( -). The long forms are more readable, while the short forms are faster to type. When executing tar commands, you can use the long or the short form of the tar operations and options. If not provided, the entire archive is extracted.
0 Comments
Leave a Reply. |