How Do I Copy and Paste a File from One Directory to Another in Linux?
Contents

To copy files and directories use the cp command under a Linux, UNIX-like, and BSD like operating systems. cp is the command entered in a Unix and Linux shell to copy a file from one place to another, possibly on a different filesystem.

How do I copy a file from one directory to another in Linux?

‘cp’ command is one of the basic and most widely used Linux commands for copying files and directories from one location to another.
…
Common options for cp command:

Options Description
-r/R Copy directories recursively
-n Don’t overwrite an existing file
-d Copy a link file
-i Prompt before overwrite

How do you copy all the files from a directory to another directory?

Copying files (cp command)

  1. To make a copy of a file in the current directory, type the following: cp prog.c prog.bak. …
  2. To copy a file in your current directory into another directory, type the following: cp jones /home/nick/clients.
Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest