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 Perfect solution Inc. The company has a Linux-based
network. You are a root user on the Red Hat operating system. You want to see only 10 results in
a search for files that have an .html extension. Which of the following commands should you use
to accomplish the task?

PrepAway - Latest Free Exam Questions & Answers

A.
locate “*.html”

B.
locate 10 .html

C.
locate -n 10 “*.html”

D.
locate “*.html” -q

Explanation:

The locate command queries a database for all pathnames which match the specified pattern. The
–n option followed by an integer limits the results to a specific number. This command would
display only 10 results in a search for files that have an .html extension.
What is the locate command?

The locate command queries a database for all pathnames which match the specified pattern. The
database is updated periodically (usually weekly or daily), and contains the pathnames of all files
which are publicly accessible.
Syntax for the locate command is as follows: locate [options] pattern …
Here, pattern means one or more file patterns.
The following options are used with the locate command:

Answer option A is incorrect. This command uses the star wildcard to display all files on the
system that have the .html filename extension.
Answer option D is incorrect. The -q option is used to suppress error messages, such as those
that might be returned in the event that the user does not have permission to access designated
files or directories. Thus, this command would suppress any error messages regarding tothis
search.
Answer option B is incorrect. When this command is run on the terminal an error message will be
displayed on the screen.


Leave a Reply