Which command creates a tar.gz archive from a file named file.txt?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

Which command creates a tar.gz archive from a file named file.txt?

Explanation:
Creating a tar.gz archive involves packaging files into a tarball and compressing it with gzip. The flags you need are: create (-c) to build a new archive, gzip compression (-z), verbose output (-v) if you want to see progress, and the archive name (-f) immediately after the options. Then list the files to include. So the command tar -zcvf file.tar.gz file.txt creates a gzip-compressed tarball named file.tar.gz containing file.txt. If you used -x, you’d extract instead; the other options shown (gpg or netstat) perform entirely different tasks.

Creating a tar.gz archive involves packaging files into a tarball and compressing it with gzip. The flags you need are: create (-c) to build a new archive, gzip compression (-z), verbose output (-v) if you want to see progress, and the archive name (-f) immediately after the options. Then list the files to include. So the command tar -zcvf file.tar.gz file.txt creates a gzip-compressed tarball named file.tar.gz containing file.txt. If you used -x, you’d extract instead; the other options shown (gpg or netstat) perform entirely different tasks.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy