Exam 010-160 Topic 18 Question 23 Discussion

Actual exam question for Lpi's 010-160 exam
Question #: 23
Topic #: 18
A directory contains the following three files:
texts 1.txt
texts 2.txt
texts 3.csv
Which command copies the two files ending in.txtto the/tmp/directory?

Suggested Answer: B Vote an answer

Explanation
The correct command to copy the two files ending in .txt to the /tmp/ directory is cp *.txt /tmp/. This command uses the wildcard character * to match any number of characters beforethe .txt extension. Therefore, it will copy both texts 1.txt and texts 2.txt to the destination directory /tmp/. The other options are incorrect because they use different wildcard characters or syntax that do not match the desired files. For example, option A uses ?? to match exactly two characters before the .txt extension, but the files have a space and a number, which are not considered as one character. Option C uses a backslash \ to escape the dot . before the .txt extension, but this is unnecessary and will cause the command to fail. Option D uses ? to match exactly one character before the .txt extension, but the files have more than one character. Option E uses $? to match the exit status of the previous command before the .txt extension, but this is not relevant and will cause the command to fail123 References: 1: Linux wildcards | How do wildcards work in Linux with examples? - EDUCBA 2: Wildcards in Linux explained with 10 examples | FOSS Linux 3: What are wildcard characters in Linux? - Sage-Answers

by Corey at Nov 13, 2024, 09:15 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10