Archiving and Compression Flashcards
6 cards from real 010-160 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 Archiving and Compression flashcards as text
A system administrator wants to package a directory named `/project_logs` into a single compressed file. They need to ensure the highest possible compression ratio, as storage space is limited. Speed is not a primary concern. Which command should they use?
Answer: tar -cJf project_logs.tar.xz /project_logs
The `tar` command is used to create archives. The `-c` flag creates an archive, `-f` specifies the filename. The compression method is chosen by another flag: `-z` for gzip, `-j` for bzip2, and `-J` for xz. Among these options, xz (`-J`) generally provides the best compression ratio, which is the key requirement of the scenario.
You have a compressed archive named `backup.tar.gz`. Before extracting it, you need to see the list of files it contains without modifying the archive. Which of the following commands will achieve this?
Answer: tar -tvf backup.tar.gz
The `tar` command with the `-t` (or `--list`) option is used to list the contents of an archive without extracting them. The `-v` option provides a verbose (detailed) listing, and `-f` specifies the archive file. The `-x` option would extract the files, and `-c` would try to create a new archive. `gunzip` would decompress the file but not list the contents of the `.tar` archive within.
By default, when you use the `gzip` command on a file (e.g., `gzip myfile.txt`), what happens to the original file?
Answer: The original file is deleted and replaced by myfile.txt.gz.
The default behavior of the `gzip` command is to compress the specified file and replace it with the compressed version, which has a `.gz` extension. The original file is removed. To keep the original file, the `-k` (or `--keep`) option must be used.
A user has an archive named `data.tar.bz2` and needs to extract only a single file named `config/settings.conf` from within it. Which command will accomplish this specific task?
Answer: tar -xjf data.tar.bz2 config/settings.conf
To extract a specific file from a `tar` archive, you provide the path to that file as an argument after the archive name. The command `tar -xjf data.tar.bz2` correctly specifies the extraction (`-x`), indicates it's a bzip2 file (`-j`), and provides the archive filename (`-f data.tar.bz2`), followed by the specific member to extract. While the `bunzip2` and `tar` combination would work, it's an unnecessary two-step process. `grep` would only list the file, not extract it.
Which of the following commands is used to decompress a file that has a `.bz2` extension?
Answer: bunzip2
Files with a `.bz2` extension are compressed with the bzip2 algorithm. The corresponding command to decompress them is `bunzip2`. `gunzip` is for `.gz` files, `unzip` is for `.zip` files, and `unxz` is for `.xz` files.
A user needs to create a single archive file from two separate files, `report.txt` and `data.csv`, and then compress it using `gzip`. Which single command can achieve this?
Answer: tar -czf archive.tar.gz report.txt data.csv
The `tar` command is designed to bundle multiple files or directories into a single archive file. The `-c` option creates an archive, the `-z` option filters it through `gzip` for compression, and the `-f` option specifies the output filename. This single command correctly creates the archive and compresses it simultaneously. The `gzip` command itself can only operate on single files, not combine them.
Written and edited by Nathan Beja, founder of Practice Test Geeks, with AI assistance. Exam facts are checked against the official sources linked below. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- lpi.org — Test delivery, eligibility, exam format, score validity, passing score, score release, fees · verified Dec 2026
- pearsonvue.com — Time limit · verified Nov 2026