To verify that your files were extracted correctly using the tar command, you can use several methods depending on how much detail you want:
1. View File Structure (Visual Verification)
The most common way is to look at the directory where you extracted the files. As mentioned in your current step, use the tree command for a graphical view:
tree extracted
If tree isn't installed, use the recursive list command:
ls -R extracted
2. Verify During Extraction (The -v Flag)
In your command tar -xzvf ..., the -v stands for verbose. When you include this flag, tar will print the name of every file to the terminal as it extracts them. If you see your filenames scroll by without error messages, the extraction is likely working.
3. Check File Content
If you want to be 100% sure the data inside isn't corrupted, you can check the content of one of the extracted files using cat:
cat extracted/test_dir/file1.txt
It should display: This is file 1
4. Compare with the Original (Expert Tip)
If you want to verify the extracted files are identical to the originals, you can use the diff command:
diff -r test_dir extracted/test_dir
If there is no output, it means the directories are identical. If something is different, diff will tell you exactly what changed.
For this lab, simply using ls -R extracted is the best and quickest way to confirm you've successfully completed the step!