Working with Files

The following sections describe utilities that copy, move, and print files.

cp: Copies a File

The cp (copy) utility makes a copy of a file. This utility can copy any file, including text and executable program (binary) files. You can use cp to make a backup copy of a file or a copy to experiment with.

A cp command line uses the following syntax to specify source and destination files:

							cp source-file destination-file
						

The source-file is the name of the file that cp is going to copy. The destination-file is the name that cp assigns to the resulting—new—copy of the file.

tip || cp Can Destroy a File

If the destination-file exists before you give a cp command, cp overwrites it. Because cp overwrites (and destroys the contents ...

Get A Practical Guide to Red Hat® Linux® 8 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.