The cp and mv Utilities
Learn how to copy, rename, and move the files and directories.
We'll cover the following...
cp
and mv
The cp
and mv
utilities copy and move file system objects. Their interfaces are almost the same. We specify the target file or directory in the first parameter, and pass the new path for the object in the second parameter.
Below is an example. We want to copy the report.txt
file. First, we should go to its directory. Second, call the cp
utility like this:
cp report.txt report-2019.txt
Copying and moving files
Run the commands discussed in this lesson in the terminal below.
This command creates the new file report-2019.txt
in the current directory. Both report-2019.txt
and report.txt
files have the same content.
Let’s suppose that we don’t need ...