# cp
- [Command Function](#section6841203041513)
- [Syntax](#section24286359150)
- [Parameter Description](#section558617385152)
- [Usage](#section16128156162)
- [Example](#section19354171211618)
- [Output](#section16754183195914)
## Command Function
This command is used to create a copy for a file.
## Syntax
cp \[_SOURCEFILE_\] \[_DESTFILE_\]
## Parameter Description
**Table 1** Parameters
Parameter
|
Description
|
Value Range
|
SOURCEFILE
|
Indicates the path to the source file.
|
Currently, only files are supported. Directories are not supported.
|
DESTFILE
|
Indicates the path to the destination file.
|
Both directories and files are supported.
|
## Usage
- The name of the source file cannot be the same as that of the destination file in the same path.
- The source file must exist and cannot be a directory.
- The source file path supports wildcards: asterisks \(\*\) and question marks \(?\). The asterisk \(\*\) indicates any number of characters, and the question mark \(?\) represents a single character. The destination file path does not support wildcards. If the specified source file path matches multiple files, the destination file path must be a directory.
- If the destination file path is a directory, this directory must exist. In this case, the destination file is named after the source file.
- If the destination file path is a file, the directory for this file must exist. In this case, the file copy is renamed.
- Currently, this command can be used to copy only one file. If more than two parameters are specified, only the first two parameters take effect.
- If the destination file does not exist, a new file is created. If the destination file already exists, the existing file is overwritten.
When important system resources are copied, unexpected results such as a system breakdown may occur. For example, when the **/dev/uartdev-0** file is copied, the system may stop responding.
## Example
Enter **cp hello-harmony.txt ./tmp/**.
## Output
**Figure 1** File copying result
