010-100 · Question #50
Which of the following commands can be used to extract content from a tar file?
The correct answer is A. tar -xvf. The tar -xvf command is used to extract the contents of a tar archive, with -x specifying extraction, -v enabling verbose output, and -f indicating the archive filename.
Question
Which of the following commands can be used to extract content from a tar file?
Options
- Atar -xvf
- Btar -vf
- Ctar -e
- Dtar -c
- Etar -v
How the community answered
(50 responses)- A70% (35)
- B16% (8)
- C4% (2)
- D8% (4)
- E2% (1)
Why each option
The tar -xvf command is used to extract the contents of a tar archive, with -x specifying extraction, -v enabling verbose output, and -f indicating the archive filename.
The -x flag tells tar to extract files from an archive, -v enables verbose mode to list files as they are extracted, and -f specifies that the next argument is the archive filename. Together, tar -xvf is the standard command for extracting tar archives on Linux systems.
tar -vf only specifies verbose mode and a filename but omits the operation flag (-x, -c, etc.), so tar does not know what action to perform.
The -e flag is not a valid standard tar option for extraction; -x is the correct flag for extracting files.
tar -c is the flag for creating a new archive, not extracting one.
tar -v alone only enables verbose output and specifies no operation or filename, making it an incomplete and invalid command for extraction.
Concept tested: Linux tar command extraction syntax
Source: https://man7.org/linux/man-pages/man1/tar.1.html
Topics
Community Discussion
No community discussion yet for this question.