nerdexam
CompTIA

XK0-006 · Question #107

An administrator needs to append the output of a Linux command to an existing file for later analysis. Which of the following command-line strings should the administrator use?

The correct answer is D. ls >> file.txt. This command uses output redirection in append mode, adding the command’s output to the end of the existing file without overwriting its current contents.

Automation and Scripting

Question

An administrator needs to append the output of a Linux command to an existing file for later analysis. Which of the following command-line strings should the administrator use?

Options

  • Acat ls > file.txt
  • Btcc ls > awk file.txt
  • Cecho ls | sed -i file.txt
  • Dls >> file.txt

How the community answered

(28 responses)
  • A
    7% (2)
  • B
    4% (1)
  • D
    89% (25)

Explanation

This command uses output redirection in append mode, adding the command’s output to the end of the existing file without overwriting its current contents.

Topics

#I/O redirection#append operator#shell#output redirection

Community Discussion

No community discussion yet for this question.

Full XK0-006 Practice