Which flag is used to compress a tar file with gzip?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The option that corresponds to compressing a tar file with gzip is indeed the flag -z. When creating a tar archive, the -z flag tells the tar command to integrate the gzip compression algorithm into the process. This allows the resulting .tar file to be much smaller in size because it applies gzip compression to the data being archived.

Using the -z flag is common practice when archiving files for storage or transfer, as it significantly reduces the file size, making it easier and faster to work with. The end result is typically a .tar.gz or .tgz file, which indicates that the tar file has been compressed using gzip.

Other flags, like -t, -D, and -j, either serve different purposes or refer to other compression methods. The -j flag is for bzip2 compression instead, and the -t flag is used to list the contents of an archive without extracting it, while -D is not commonly associated with the tar command’s compression functionalities. Understanding these distinctions is crucial for effective file management in a Linux environment.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy