In Ubuntu, the cp
command is used to copy files and directories.
Here’s the basic syntax of the cp
command:
cp [OPTION]... SOURCE DEST
Where SOURCE
is the file or directory that you want to copy, and DEST
is the destination directory where you want to copy the file to.
For example, to copy a file named file.txt
to a directory named dest_dir/
, use the following command:
cp file.txt dest_dir/
You can also use options with the cp
command to specify how it should handle the copy operation. For example, the -r
option is used to copy directories recursively:
cp -r source_dir dest_dir/
This will copy all files and subdirectories in source_dir
to dest_dir/
.
There are many other options available with the cp
command, such as -v
for verbose output, -n
for no clobber, -u
for update, and so on. For more information on these options, run man cp
in the terminal to access the manual page.