What command would copy all files ending in .pdf to the Documents directory?

Prepare for the LPI Linux Essentials Exam. Study with flashcards and multiple choice questions, each with hints and explanations. Get exam-ready!

The command that successfully copies all files ending in .pdf to the Documents directory is structured as follows: "cp *.pdf Documents/".

In this command, "cp" is the command used to copy files from one location to another. The "*.pdf" part is a wildcard that matches any files in the current directory with the .pdf extension, effectively selecting all PDF files. The "Documents/" specifies the target directory where these files will be copied. The command will remain in the current directory, looking for .pdf files and duplicating them into the specified Documents folder without altering the originals.

The other commands do not accomplish the task as required:

  • "copy *.pdf Documents/" is incorrect because "copy" is not a recognized command in Linux; it is a command used in DOS and Windows.

  • "cp Documents/*.pdf" suggests copying PDF files from the Documents directory to the current directory rather than copying to it, reversing the intended action.

  • "mv *.pdf Documents/" is not suitable either because "mv" is used to move files, which would remove the original PDF files from their current location instead of merely copying them.

Thus, the chosen command is the only one that correctly fulfills the requirement to copy PDF files to the

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy