exam questions

Exam XK0-004 All Questions

View all questions & answers for the XK0-004 exam

Exam XK0-004 topic 1 question 161 discussion

Actual exam question from CompTIA's XK0-004
Question #: 161
Topic #: 1
[All XK0-004 Questions]

An administrator needs to create a file named hello in the home directory that contains the following text: it's me!
Which of the following commands would accomplish this goal?

  • A. mkdir ~/hello touch ~/"it's me!"
  • B. touch ~/hello echo "it's me!" > ~/hello
  • C. mv ~/hello cp "it's me!" > ~/hello
  • D. type ~/hello print "it's me!"
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
alfre
Highly Voted 4 years, 7 months ago
correct answer is B
upvoted 16 times
...
giannisae
Highly Voted 4 years, 7 months ago
B is correct
upvoted 7 times
...
BERNOULIX
Most Recent 1 year, 12 months ago
Selected Answer: B
correct answer is B
upvoted 1 times
...
examtopics_htc
2 years, 9 months ago
Selected Answer: B
It's B, but you don't need to touch the file, you can just do the echo
upvoted 3 times
luken7777
2 years ago
and there's no semicolon between touch and echo
upvoted 1 times
...
...
xeun88
2 years, 9 months ago
The questions said a file not a directory mkdir is for directory while touch is for files The answer is B
upvoted 2 times
...
pinonino
3 years, 1 month ago
Agree with the answer B: It is also used to create an empty file with the specified file name, assuming the file does not exist or changes the time of access to already existing file.
upvoted 1 times
...
Dracolitch
3 years, 5 months ago
To anyone that answers this A... go back to windows and apple... no need to try any more. For everyone else: task 1: Create a file named hello in the home directory. # touch ~/hello Task 2: the hello file must contain the text "it's me!". # echo "it's me!" > ~/hello Correct Answer is B.
upvoted 6 times
...
Didi31
3 years, 6 months ago
B is the correct answer on this one.
upvoted 3 times
...
Mikey_
4 years, 7 months ago
why are you making a dir??
upvoted 6 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.

SaveCancel
Loading ...