010-150 · Question #13
Which of the following commands can be used to extract files from an archive?
The correct answer is B. tar -xvf. The tar -xvf command is the standard way to extract files from a tar archive, where -x triggers extraction, -v enables verbose output, and -f specifies the archive file.
Question
Which of the following commands can be used to extract files from an archive?
Options
- Atar -vf
- Btar -xvf
- Ctar -evf
- Dtar -e
- Etar 璿
How the community answered
(59 responses)- A2% (1)
- B75% (44)
- C14% (8)
- D7% (4)
- E3% (2)
Why each option
The `tar -xvf` command is the standard way to extract files from a tar archive, where `-x` triggers extraction, `-v` enables verbose output, and `-f` specifies the archive file.
`tar -vf` omits the `-x` extract flag, so tar has no operation mode specified and will return an error rather than extracting any files.
The `-x` flag tells `tar` to extract files from an archive, `-v` (verbose) lists each file as it is processed, and `-f` specifies the filename of the archive to operate on. Together, `tar -xvf archive.tar` is the correct and complete syntax for extracting the contents of a tar archive.
`tar -evf` uses `-e`, which is not a valid standard tar operation flag for extraction; `-e` does not exist as an extract option in GNU tar.
`tar -e` is not a valid tar option and does not specify an archive filename with `-f`, making it an incomplete and incorrect command.
`tar 璿` uses an invalid non-ASCII character as an option flag, which is not a recognized tar argument and will cause an error.
Concept tested: tar archive extraction flags and syntax
Source: https://man7.org/linux/man-pages/man1/tar.1.html
Topics
Community Discussion
No community discussion yet for this question.