How to Use Cp Command in Linux?

How to Use Cp Command in Linux?
Contents

Linux Copy File Examples

  • Copy a file to another directory. To copy a file from your current directory into another directory called /tmp/, enter:
  • Verbose option. To see files as they are copied pass the -v option as follows to the cp command:
  • Preserve file attributes.
  • Copying all files.
  • Recursive copy.

How do I use CP in Linux?

Read on to find out more.

  1. mv: Moving (and Renaming) Files. The mv command lets you move a file from one directory location to another.
  2. cp: Copying Files. A basic example of the cp command to copy files (keep the original file and make a duplicate of it) might look like: cp joe_expenses cashflow.
  3. rm: Deleting Files.

What does CP Command do?

The cp command is a command-line utility for copying files and directories. It supports moving one or more files or folders with options for taking backups and preserving attributes.

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.