The output will look similar to: tar: Removing leading `/' from member names Here is what each of those switches means:įor example, to compress the /pepper directory to an archive named, run this command: tar -czvf /pepper The general command to compress a single file or directory in Linux is: tar -czvf #How to Compress a Single File or Directory Using -J instead of -z will use xz instead of gzip. Replacing -z with -j in the commands will use bzip2 instead of gzip. Note: In our examples, we'll focus on using gzip. Generally, gzip and bzip2 are comparable from a compression and performance perspective, but gzip is more widely used.xz tends to give the best overall compression but also takes more time and Linux desktop computer resources. The table below details some of the basic differences between these compression tools. Gzip isn't the only compression program tar can use. tar's z switch makes the tar command use gzip. tar can use gzip to compress the files it archives. However, these tools are not mutually exclusive. Tar creates archives from multiple files while gzip compresses files. The basic difference between the two tools is: When dealing with Linux archives, you're likely to hear about tar and gzip, often in similar contexts. In addition to creating archives, tar can perform compression and decompression using several different compression utilities such as gzip and bzip2. In opensource and Linux communities, tarballs are one of the most common methods for distributing source code and other important files. Tar - short for "tape archive" - is a GNU command line tool for creating and extracting archives.Īn archive is a single file that includes multiple files or directories. We'll use Ubuntu 20.04 for all examples, but you can follow along on any Linux system that uses tar. In this article, we'll demonstrate how you can use the tar utility to archive, compress, and extract files on Linux systems. bz2 extension, there's a good chance it was created using the. If you've ever worked with "tarball" files that have the. Archiving, compressing, and extracting files are some of the most common tasks for a Linux administrator.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |