How to copy a file or folder in Ubuntu?


by adelia , in category: General Help , 8 months ago

How to copy a file or folder in Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by sarai_bergstrom , 8 months ago


To copy a file or folder in Ubuntu, you can use the cp command. Here's how:

  1. Open the Terminal by pressing Ctrl+Alt+T.
  2. Navigate to the directory where the file or folder is located using the cd command.
  3. Once you're in the correct directory, use the cp command followed by the name of the file or folder you want to copy and the destination where you want to copy it. For example, to copy a file named example.txt to a folder called backup located in your home directory, you would type:
cp example.txt ~/backup/

If you want to copy a folder called myfolder and all its contents to a folder called backup, you would type:

cp -r myfolder ~/backup/

Note that the -r option is used to copy directories and their contents recursively.