PrepAway - Latest Free Exam Questions & Answers

Which of the following commands should you use to accomplish the task?

You work as the Network Administrator for McNeil Inc. The company has a Linux-based network.
You are a root user on the Red Hat operating system. You want view all files on the system that
have the .xml filename extension. Which of the following commands should you use to accomplish
the task?

PrepAway - Latest Free Exam Questions & Answers

A.
locate .xml

B.
locate -name /.xml

C.
locate “*.xml”

D.
cat .xml

Explanation:

The locate command queries a database for all pathnames that match the specified pattern. The
specificity of locate can be increased by using it together with wildcards or other regular
expressions. This command uses the star wildcard to display all files on the system that have the
.xml filename extension.
What is a regular expression?
A regular expression is a way of describing a string of text using metacharacters or wildcard
symbols.
For example, “*.xml” is a regular expression that refers to all files having the extension .xml.
What is a wildcard?
The specificity of LOCATE can be increased by using it together with wildcards or other regular
expressions. Wildcards are characters that can be used to substitute for any other character or
characters. For example, the star character (*) is a wildcard that can represent any single
character or any string containing any number of characters.
Answer option A is incorrect. This is an incorrect syntax and an error messages will be displayed.
Answer option D is incorrect. The cat command displays the content of the specified file.
Answer option B is incorrect. This is an incorrect command, when you type this command an error
message will be displayed.


Leave a Reply