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.


When using the tar utility, which option (switch) is needed to list the contents of an archive?

  1. -c

  2. -t

  3. -x

  4. -l

The correct answer is: -t

The tar utility is commonly used for creating and handling archive files in Linux. To list the contents of an archive without extracting the files, the appropriate switch is crucial. The option that allows you to do this is -t, which stands for "list." When you use the -t switch with tar, it will display the files contained within the specified archive. This is an essential functionality for users who want to review the contents of an archive before deciding to extract any files. This capability is particularly valuable when dealing with large archives or when you need to verify the files that are included without making any modifications to the archive itself. The other options serve different purposes. The -c switch is used for creating a new archive, while the -x switch is for extracting the files from an existing archive. The -l switch, on the other hand, is not a standard option associated with the tar command, making it irrelevant in this context. Understanding the correct use of these options is important for effective file management using tar.