nerdexam
CompTIA

XK0-005 · Question #1724

A newly hired junior administrator is studying the format of the /var/log/messages file. Which of the following commands should the administrator use to preserve the contents of the original file…

The correct answer is C. cat /var/log/messages > /home/admin/messages. Using shell redirection with cat reads the original file and writes its contents to a new file, preserving /var/log/messages and creating an identical copy at /home/admin/messages: cat /var/log/messages > /home/admin/messages

System Management

Question

A newly hired junior administrator is studying the format of the /var/log/messages file. Which of the following commands should the administrator use to preserve the contents of the original file while also creating an identical file in the /home/admin directory?

Options

  • Atouch /var/log/messages /home/admin
  • Bmv /var/log/messages /home/admin
  • Ccat /var/log/messages > /home/admin/messages
  • Dln -s /var/log/messages /home/admin

How the community answered

(27 responses)
  • B
    7% (2)
  • C
    89% (24)
  • D
    4% (1)

Explanation

Using shell redirection with cat reads the original file and writes its contents to a new file, preserving /var/log/messages and creating an identical copy at /home/admin/messages: cat /var/log/messages > /home/admin/messages

Topics

#Linux commands#File management#Output redirection#Logging

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice