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
Theodora
2 days ago
Definitely D, can’t go wrong with that one!
upvoted 0 times
...
Refugia
7 days ago
I’m surprised that B is even listed, it seems off.
upvoted 0 times
...
Jacki
12 days ago
Wait, why is A even an option? That looks wrong.
upvoted 0 times
...
Lavonna
18 days ago
I think E might work too, but not as precise.
upvoted 0 times
...
Cortney
23 days ago
D is the correct command!
upvoted 0 times
...
Letha
28 days 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
1 month 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
1 month 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
1 month 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