010-160 Exam QuestionsBrowse all questions from this exam

010-160 Exam - Question 39


A directory contains the following three files:

texts 1.txt

texts 2.txt

texts 3.csv

Which command copies the two files ending in .txt to the /tmp/ directory?

Show Answer
Correct Answer: B

To copy files that end with .txt to the /tmp/ directory, the command cp *.txt /tmp/ is the correct command. The asterisk (*) is a wildcard character that matches any number of characters. Therefore, *.txt will match all files in the directory that have a .txt extension, including texts 1.txt and texts 2.txt.

Discussion

7 comments
Sign in to comment
Styles
Aug 25, 2020

*. txt means all the txt files

sasquatchshrimp
Jun 13, 2021

B is the correct answer. the "*" is a "wildcard" meaning it looks for anything with .txt at the end.

Nunjamin
Jul 28, 2020

cp ?.txt /tmp/ would also copy the two .txt files wouldn't it?

WaldoWhereAmI
Aug 22, 2020

No ? = Matches up exactly one character

Jay987654Option: B
Jun 27, 2024

The correct answer is B! B - "cp *.txt /tmp/" is the command for copying all files ending in ".txt" to the "/tmp/" directory. This is a wildcard match, which means that any file in the current directory with a ".txt" extension will be copied.

emigrin14Option: D
Mar 25, 2024

Both B and D results in the same solution. Considering both 1.txt and 2.txt has exactly one character before ".txt", the question mark ? in answer D results in matching those two files in the resolution. That being said, the aserisk * in answer B also matches AT LEAST 1 character before ".txt".

TacosInMyBellyOption: B
May 30, 2024

As stated before, "*" selects all .txt files, while "?" is for exactly one character such as "1.txt"

e5c1bb5Option: B
Apr 9, 2025

? wont work because "texts" is part of the file name. has to be B