Quiz: Compression, Archives, and File Search
Test your understanding of file compression and search tools.
1. What does the tar command do by itself (without compression)?
- Compresses files
- Creates or extracts archive bundles of files
- Searches for files
- Transfers files between systems
Show Answer
The correct answer is B. tar (tape archive) bundles multiple files and directories into a single archive file, preserving permissions and structure. By itself, tar doesn't compress—add -z for gzip or -j for bzip2 compression.
Concept Tested: Tar Command
2. What does tar -czvf archive.tar.gz folder/ do?
- Extracts an archive
- Creates a gzip-compressed archive of the folder
- Lists contents of an archive
- Tests archive integrity
Show Answer
The correct answer is B. The flags mean: -c (create), -z (gzip compress), -v (verbose), -f (filename follows). This creates a gzip-compressed tar archive named archive.tar.gz containing the folder.
Concept Tested: Tar Options
3. How do you extract a .tar.gz file?
- tar -czvf archive.tar.gz
- tar -xzvf archive.tar.gz
- unzip archive.tar.gz
- extract archive.tar.gz
Show Answer
The correct answer is B. Use -x (extract) instead of -c (create). The -z handles gzip, -v shows files being extracted, and -f precedes the filename. The archive extracts to the current directory.
Concept Tested: Extracting Archives
4. What is the difference between gzip and zip?
- They're identical
- gzip compresses single files; zip creates compressed archives
- zip is Linux-only
- gzip creates larger files
Show Answer
The correct answer is B. gzip compresses individual files (creating .gz files) and is typically combined with tar for multiple files. zip creates compressed archives that can contain multiple files, and is compatible with Windows.
Concept Tested: Gzip vs Zip
5. What does the find command do?
- Searches inside files for text
- Searches for files and directories based on criteria
- Finds your current location
- Finds network devices
Show Answer
The correct answer is B. find searches for files and directories based on various criteria like name, size, type, modification time, and permissions. Example: find /home -name "*.txt" finds all .txt files under /home.
Concept Tested: Find Command
6. What does find . -name "*.log" -mtime +7 do?
- Finds log files modified in the last 7 minutes
- Finds log files modified more than 7 days ago
- Finds 7 log files
- Finds log files larger than 7MB
Show Answer
The correct answer is B. This finds files with .log extension that were modified more than 7 days ago (+7). Use -7 for less than 7 days, or 7 for exactly 7 days.
Concept Tested: Find Options
7. What is locate and how does it differ from find?
- They're identical
- locate uses a database for faster searches; find searches in real-time
- find is faster
- locate only works on Windows
Show Answer
The correct answer is B. locate uses a pre-built database (updatedb) for near-instant searches, but may miss recently created files. find searches the filesystem in real-time, so it's slower but always current.
Concept Tested: Locate Command
8. What command shows which executable a command name resolves to?
- find
- which
- where
- what
Show Answer
The correct answer is B. which shows the full path of the executable that would run when you type a command. For example, which python might show /usr/bin/python. Useful for finding which version of a program is in your PATH.
Concept Tested: Which Command
9. What does xz provide compared to gzip?
- Lower compression
- Higher compression ratio but slower
- Faster but larger files
- Only works on text files
Show Answer
The correct answer is B. xz provides higher compression ratios than gzip (smaller files) but is slower to compress. It's often used for distributing source code packages where download size matters more than compression speed.
Concept Tested: Xz Compression
10. How do you search for files larger than 100MB?
- find / -size 100M
- find / -size +100M
- ls -size 100M
- search --size 100M
Show Answer
The correct answer is B. find / -size +100M finds files larger than 100 megabytes. The + means "greater than." Use -100M for smaller than, or just 100M for exactly that size. Great for finding disk space hogs.
Concept Tested: Find by Size