nerdexam
CompTIACompTIA

XK0-005 · Question #10640

XK0-005 Question #10640: Real Exam Question with Answer & Explanation

The correct answer is A: find . -name "experiment*.txt" -exec rm "{}" ;. The "Argument list too long" error occurs when the number of files exceeds the command-line argument limit. The find command with -exec is a workaround, as it processes files one by one, avoiding the argument limit. This method is efficient for handling large numbers of files.

Troubleshooting

Question

A user is cleaning up a directory because it has more than 100,000 files that were generated from an experiment. When the user tries to remove the unneeded experiment files, the user receives an error: arduino cannot execute [Argument list too long] Which of the following should the user execute to remove these files?

Options

  • Afind . -name "experiment*.txt" -exec rm "{}" ;
  • Brm -rf experiment*.txt
  • Crm --force experiment*.txt
  • Dfor i in experiment*.txt; do find . -name $i -exec rmdir "{}" ; done

Explanation

The "Argument list too long" error occurs when the number of files exceeds the command-line argument limit. The find command with -exec is a workaround, as it processes files one by one, avoiding the argument limit. This method is efficient for handling large numbers of files.

Topics

#file management#command line utilities#argument list limit#linux administration

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions