The cp Command

When you want to make a copy of a file, you can use the cp command. The cp command will allow you to copy a single file to a new destination file, or copy one or more files to a single destination directory. This file operation will come up many times in your workings with Unix. It's not uncommon to want to make copies of files you are working on. If you wanted to make a quick backup copy of a file, this command could help you do that.

To use the cp command to make a copy of a single file, follow these steps:

1.
Determine the source filename, and the destination filename to which you'd like to copy the file.
2.
Issue the cp command as cp <sourcefile> <destinationfile>.

There will be times where you may not have just one file, but ...

Get SAMS Teach Yourself Unix in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.