Search⌘ K
AI Features

Copying Files in Bash

Explore the cp command in Bash to copy files and directories effectively. Learn about common options like recursive, force, and backup, as well as using wildcards to copy multiple files. This lesson helps you understand file copying in the command line for better file manipulation.

cp

Definition:

This command is one of the most frequently used commands. It is used to copy files and directories. By default, cp copies files but not directories. Always be careful while choosing name for new files because the content might be lost if you use a file name that already exists. If you’re placing the copied version in the same directory then it must have a different name than the original name.

Syntax:

cp [option] [file_name]
...