PrepAway - Latest Free Exam Questions & Answers

Which of the following commands will you run to do case-sensitive search for files named foobar.png?

Which of the following commands will you run to do case-sensitive search for files named
foobar.png?

PrepAway - Latest Free Exam Questions & Answers

A.
locate -name foobar.png

B.
find -iname foobar.png

C.
grep-name foobar.png

D.
find -name foobar.png

Explanation:

You will use find -name foobar.png command to do case-senstive search for files named
foobar.png.
What is the find command?
The find command can perform a search based on a variety of search limitations. It searches
through one or more directory tree(s) of a filesystem, locating files based on some user-specified
criteria. By default, find returns all files in the current working directory. Further, find allows a user
to specify an action to be taken on each matched file.
Thus, it is an extremely powerful command for applying actions to many files.
The find command can be used with a wild card (*), but it works best when we know the name of
the file or directory we are looking for.
The find command can search your system for files that comply with certain numeric criteria, such
as the size of the file (-size), the number of links to the file (-links), the date of the last change to
the files data (-mtime), or the date of the last time the file was read (-atime). All these criteria
accept a numeric value. When a numeric value is provided to find, it looks for an exact match,
more than the number, or less than the number.
Answer option B is incorrect. The find -iname foobar.png command will do case-insensitive search
for files named foobar.png.
Answer option C is incorrect. The grep-name foobar.png is an invalid command.

What is the grep command?
The grep command is used to search for a specific pattern of text in a file. It helps administrators
in searching large amounts of text for a certain error message or name.
Answer option A is incorrect. The locate -name foobar.png is an invalid command.
What is the locate command?
The locate command is used to search for matching files in a database that is usually updated
daily by a cron job. On the forthcoming Linux operating systems, this command is usually replaced
by the slocate command, which stores permissions as well as paths and thus prevents users from
prying into directories. One more advantage of the locate command is that it matches against any
part of a pathname, not just the file itself.


Leave a Reply