RHEL Linux - Red Hat System Administration Practice Exam

Disable ads (and more) with a membership for a one time $4.99 payment

Study for the RHEL Linux - Red Hat System Administration Exam. Enhance your knowledge with flashcards and multiple-choice questions, complete with hints and explanations. Prepare for your certification!

Practice this question and more.


Which command is used to extract files from a tar archive?

  1. tar -xf

  2. tar -cvf

  3. tar -cf

  4. tar -rzf

The correct answer is: tar -xf

The command used to extract files from a tar archive is indeed "tar -xf". In this command, "tar" refers to the tape archive utility, while the "x" option stands for extracting the files from the archive. The "f" option indicates that the next argument is the filename of the archive from which the files will be extracted. When you run "tar -xf filename.tar", it will unpack the contents of the specified tar archive into the current directory, preserving the original directory structure and file permissions as they were in the archive. This command is essential for accessing files stored in a tar format, which is a common way to compress and bundle files in Unix and Linux systems. The other commands presented do not fit the context of extracting files. For instance, the "tar -cvf" command is used for creating a tar archive, where "c" signifies create and "v" stands for verbose mode, showing the progress. The "tar -cf" also relates to creating an archive, lacking the verbose option. Lastly, "tar -rzf" combines compression with gzip for creating an archive rather than extracting one, as indicated by the "z" option for gzip compression. Understanding these distinctions helps in effectively managing