LFCS Essential Commands Practice Question
Which TWO commands can be used to list the contents of a tar archive without extracting it?
⚠ Common exam trap
It's easy for candidates to confuse the `-t` (list) flag with `-x` (extract) or forget that compressed archives require an additional decompression flag (like `-z` or `-j`) even for listing, leading them to pick extraction options like D or E.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
tar -tvf archive.tar
`tar -tvf archive.tar` lists the contents of a tar archive without extracting it. The `-t` flag tells tar to list the archive's table of contents, `-v` provides verbose output (showing file permissions, ownership, size, and timestamp), and `-f` specifies the archive file. This works for uncompressed tar archives.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
tar -tvf archive.tar
Why this is correct
tar -tvf lists the contents of a tar archive verbosely without extracting.
- ✓
tar -ztvf archive.tar.gz
Why this is correct
tar -ztvf lists contents of a gzipped tar archive without extracting.
- ✗
tar --list archive.tar
Why it's wrong here
While --list is valid, it is redundant with -t, and the question expects specific flag combinations. Also, tar --list may not be as commonly used.
- ✗
tar -xjf archive.tar.bz2
Why it's wrong here
tar -xjf extracts a bzip2-compressed archive.
- ✗
tar -xvf archive.tar
Why it's wrong here
tar -xvf extracts the archive.
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.