Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

LPI 010-160 Exam - Topic 3 Question 69 Discussion

Which of the following commands will search for the file foo.txt under the directory /home?
D) find /home --name foo.txt
A) search /home --file foo.txt
B) search /home foo. txt
C) find /home -- file foo.txt
E) find /home foo.txt

LPI 010-160 Exam - Topic 3 Question 69 Discussion

Actual exam question for LPI's 010-160 exam
Question #: 69
Topic #: 3
[All 010-160 Questions]

Which of the following commands will search for the file foo.txt under the directory /home?

Show Suggested Answer Hide Answer
Suggested Answer: D

The correct command to search for the file foo.txt under the directory /home is find /home --name foo.txt. This command uses the find command, which is used to search for files and directories that match certain criteria. The first argument, /home, specifies the starting point of the search. The second argument, -name, indicates that the search is based on the name of the file or directory. The third argument, foo.txt, is the name of the file to be searched for. The find command will recursively search all the subdirectories under /home and print the path of any file or directory that matches the name foo.txt.

The other commands are incorrect for various reasons:

A . search /home --file foo.txt is incorrect because there is no such command as search in Linux. The correct command for searching files and directories is find.

B . search /home foo.txt is incorrect because, as mentioned above, there is no search command in Linux. Also, this command does not use any option to specify the search criteria, such as -name, -type, -size, etc.

C . find /home -- file foo.txt is incorrect because the option -file is not valid. The correct option for specifying the type of file or directory is -type, followed by a letter that indicates the type, such as f for regular file, d for directory, l for symbolic link, etc. For example, find /home -type f -name foo.txt would search for a regular file named foo.txt under /home.

E . find /home foo.txt is incorrect because this command does not use any option to specify the search criteria, such as -name, -type, -size, etc. This command will search for any file or directory that has foo.txt as part of its name, not exactly as its name. For example, this command will also match a file named barfoo.txt or a directory named foo.txt.bak.


Contribute your Thoughts:

0/2000 characters
Kris
23 hours ago
I think D is the right answer. It uses the correct syntax.
upvoted 0 times
...
Lashon
6 days ago
Definitely D. It’s the standard way to find files in Linux.
upvoted 0 times
...
Eileen
11 days ago
I like D too! It’s the best option for searching files.
upvoted 0 times
...
Eden
16 days ago
I’m leaning towards D as well. It’s straightforward.
upvoted 0 times
...
Mari
22 days ago
E is too vague. It doesn't specify the name option.
upvoted 0 times
...
Magda
27 days ago
C looks wrong too. The extra space before "file" is a mistake.
upvoted 0 times
...
Ivette
1 month ago
I feel like A is confusing. The syntax seems off.
upvoted 0 times
...
Vernell
1 month ago
Agreed! D is clear and specific.
upvoted 0 times
...
Graciela
1 month ago
I think D is the right choice. It uses the correct syntax.
upvoted 0 times
...
Theodora
2 months ago
Definitely D, can’t go wrong with that one!
upvoted 0 times
...
Refugia
2 months ago
I’m surprised that B is even listed, it seems off.
upvoted 0 times
...
Jacki
2 months ago
Wait, why is A even an option? That looks wrong.
upvoted 0 times
...
Lavonna
2 months ago
I think E might work too, but not as precise.
upvoted 0 times
...
Cortney
2 months ago
D is the correct command!
upvoted 0 times
...
Letha
2 months ago
I practiced a similar question where we had to use "find" with specific flags, so I lean towards option D being the right choice.
upvoted 0 times
...
Charlette
3 months ago
I feel like option E could be correct too, but I can't recall if it needs any flags like "--name" to work properly.
upvoted 0 times
...
Fabiola
3 months ago
I'm not entirely sure, but I remember something about using "--name" to specify the file name in the command.
upvoted 0 times
...
Mariann
3 months ago
I think the command should start with "find" since that's what we used in practice for searching files.
upvoted 0 times
...

Save Cancel