What command is used to copy a file in Linux?

Prepare for the LPI 101-500 Certification Exam. Utilize flashcards, navigate multiple choice questions, and benefit from hints and explanations. Begin your Linux certification journey today!

The command used to copy a file in Linux is cp. When you want to duplicate an existing file, cp allows you to specify the source file and the destination where the copy will be placed. It can also be used with various options to modify its behavior, such as -r for recursive copying of directories, or -i for interactive mode where it prompts before overwriting existing files.

Using mv instead would move the file to a new location rather than creating a copy. The rm command is utilized to remove files, and echo is generally used to display a line of text or output values to the terminal. Therefore, in the context of duplicating files, cp is the appropriate command.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy