βΉοΈ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.6 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://pimylifeup.com/ubuntu-copy-files/ |
| Last Crawled | 2026-03-24 03:20:07 (19 days ago) |
| First Indexed | 2024-01-16 11:03:34 (2 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Learn how to Copy Files on Ubuntu using the Terminal - Pi My Life Up |
| Meta Description | In this quick guide, you will learn how to easily copy files on the Ubuntu operating system while using the terminal. |
| Meta Canonical | null |
| Boilerpipe Text | In this quick guide, we will be showing you how to copy files on the Ubuntu operating system while using the terminal.
Knowing how to copy a file on Ubuntu is a super important skill to learn, especially if you plan on using the terminal.
On the desktop variant of Ubuntu, this is as simple as opening up the file explorer, clicking a file, and pressing
CTRL
+
C
to copy and then
CTRL
+
V
to paste.
Copying and pasting using the terminal on Ubuntu isnβt any more complicated than on the desktop. In fact, copying is all done with a single simple but powerful command.
This command we are talking about is the
cp command
. Over the following sections, we will show you how to utilize this command to copy files. You will quickly see that it is easy to remember and easy to use.
As a bonus, if you learn the copy command for one Linux operating system, you can use it on basically any operating system.
By the end of the following sections, you should have a good idea of how you can copy files on Ubuntu. We will cover a few different ways to utilize the cp command, from copying a single file to multiple ones.
Syntax of the cp command on Ubuntu
Let us start this guide with a quick look at the syntax of the cp command on the Ubuntu operating system.
Copy
[OPTIONS]
β The options parameter is entirely optional but allows you to control how this command copies files on your Ubuntu system.
For example, you can get it to create backups of files it overwrites, or you can get it to prompt you when it tries to replace files.
SOURCE...
β This command allows you to specify as many files as you want to copy. You can even use wildcards (
*
) to select multiple files that start or end with a certain string.
DESTINATION
β The copy command has one weak point: it can only copy files to a single destination. This destination must be the path to which you want the files copied.
When copying a single file on Ubuntu, you can end the destination with a filename to rename it while copying.
Copying a Single File on Ubuntu using the Terminal
At its most basic usage, the cp command on Ubuntu allows you to copy a single file to a single destination.
All you need to do to copy a file this way is to specify the β
cp
β command, followed by the name of the file or the path to the file, and finally, a path to the destination.
The destination path does not need to contain the fileβs name, but it will be renamed during copying using that name if it does.
Copy
Example of Copying a Single File
For example, we would use the following command if we wanted to copy a file named β
example.txt
β to the β
/home/pimyubu/
β directory.
Copy
If we want to copy this file on Ubuntu and change the resulting name, we simply need to specify it at the end of the directory.
For example, if we wanted to copy and rename this file to β
helloworld.txt
β we would use the command below.
Copy
How to Copy Multiple Files
To copy multiple files at once on Ubuntu, you simply need to specify multiple files when using the cp command.
You can copy as many files as you would like and even use wildcards (
*
) to select files starting, and/or ending with specified characters. If you are unsure what we mean, we will give you an example in the next section.
Just note that while you can copy multiple files at once, you cannot have multiple destinations. Additionally, you canβt rename a file when copying multiple files. The destination must be a path.
Copy
Example of Copying Multiple Files on Ubuntu
At its most basic usage, you can specify the name of each file that you want to copy to your new directory.
In the following example, we copy β
example1.txt
β and β
example2.txt
β to the β
/home/pimyubu
β directory.
Copy
The cp command on Ubuntu also supports wildcards (
*
), which allows you to copy multiple files with a single command.
For example, if we wanted to copy all files that started with β
example
β and ended with β
.txt
β we would use the following command.
Copy
Ask Before Replacing when Copying a File on Ubuntu
When copying files on Ubuntu, you will notice that it can replace any existing files without warning.
Luckily, this command has a built-in feature that allows it to ask you before overwriting files. You will want to use the β
-i
β option to activate the interactive mode.
When using this option, you will have to confirm every time the cp command attempts to overwrite a file.
Copy
You can also invoke the interactive option using the long-form version: β
--interactive
β.
Copy
Example of Asking Before Replacing a File on Ubuntu
To showcase what the interactive option does, let us copy a file that we already have saved within our directory.
We will copy the β
example1.txt
β file into the β
/home/pimyubu
β directory by using following command.
Copy
Using the β
-i
β option, if the file already exists, you will be prompted with a questions asking if you want to replace the file. To overwrite this file, simply type β
y
β and then press the
ENTER
key.
Copy
Create a Backup When using Ubuntu to Copy Files
On Ubuntu, it is also possible to copy a file and create a backup of any file the tool goes to overwrite. This is useful when you are unsure if the original file is worth keeping or if you want to revert to the original.
To get the cp command to make a backup of any file it replaces, you should use the β
-b
β option. Backups of files will end with the tilde symbol (
~
).
Copy
Like the interactive option, you can also write this as β
--backup
β. It achieves the same thing as the β
-b
β option.
Example of Creating a Backup of Files When Copying Them on Ubuntu
To give you an example of how this works. Copy the file β
example1.txt
β into the β
/home/pimyubu
β directory. This directory is where we copied the text file earlier.
By using the β
-b
β option, the cp command will create a backup of every file that already exists on your Ubuntu system.
Copy
We can now use the
ls command
to list the files in our directory.
Copy
Within this directory, we can see the newly copied file (
example1.txt
), and a backup of the file that got overwritten (
example1.txt~
).
Conclusion
Hopefully, at this stage in the guide, you will have a good idea of how to copy files on the Ubuntu system.
The cp command makes copying files on a Linux system a straightforward process.
Please feel free to comment below if you have any issues copying files on your system.
If you found this tutorial to be helpful, we recommend you check out our
many other Ubuntu tutorials
.
We won't send you spam. Unsubscribe at any time. |
| Markdown | [](https://pimylifeup.com/ "Go to Homepage")
- [Premium](https://pimylifeup.com/subscribe/)
- [Raspberry Pi](https://pimylifeup.com/raspberry-pi-index/)
- [Linux](https://pimylifeup.com/linux-index/)
- [Home Assistant](https://pimylifeup.com/category/home-assistant/)
- [Steam Deck](https://pimylifeup.com/category/steamdeck/)
- [More](https://pimylifeup.com/ubuntu-copy-files/)
- [Game Dev](https://pimylifeup.com/category/game-dev/)
- [Arduino](https://pimylifeup.com/category/arduino-projects/)
- [Electronics](https://pimylifeup.com/category/learn-electronics/)
- [Coding](https://pimylifeup.com/coding-index/)
- [Docker](https://pimylifeup.com/category/tutorials/docker/)
- [Windows](https://pimylifeup.com/category/windows/)
- [macOS](https://pimylifeup.com/category/macos/)
- [Compilations](https://pimylifeup.com/compilations/)
- [Other Tutorials](https://pimylifeup.com/category/tutorials/)
- [Archive](https://pimylifeup.com/category/archive/)
- [Courses](https://pimylifeup.com/courses/)
- [Login](https://pimylifeup.com/my-account/)
[Login](https://pimylifeup.com/my-account/)
Theme
# Learn how to Copy Files on Ubuntu using the Terminal
 by [Emmet](https://pimylifeup.com/emmet)
Published
Jan 16, 2024
[Ubuntu](https://pimylifeup.com/category/linux/ubuntu/)
Save as PDF
Not Started
Favorite
If you buy through our links, we may earn an affiliate commission. [Learn More](https://pimylifeup.com/disclaimer-privacy-policy/?utm_source=disclosure#3-other-affiliate-programs).
In this quick guide, we will be showing you how to copy files on the Ubuntu operating system while using the terminal.

Knowing how to copy a file on Ubuntu is a super important skill to learn, especially if you plan on using the terminal.
On the desktop variant of Ubuntu, this is as simple as opening up the file explorer, clicking a file, and pressing `CTRL` + `C` to copy and then `CTRL` + `V` to paste.
Copying and pasting using the terminal on Ubuntu isnβt any more complicated than on the desktop. In fact, copying is all done with a single simple but powerful command.
This command we are talking about is the [cp command](https://pimylifeup.com/cp-command-linux/). Over the following sections, we will show you how to utilize this command to copy files. You will quickly see that it is easy to remember and easy to use.
As a bonus, if you learn the copy command for one Linux operating system, you can use it on basically any operating system.
## You Might Also Like
[UbuntuHow to Copy and Paste in the Ubuntu Terminal 4 min readRead More β](https://pimylifeup.com/ubuntu-terminal-copy-paste/ "How to Copy and Paste in the Ubuntu Terminal")
[Linux GuidesHow to Copy a Directory on Linux 4 min readRead More β](https://pimylifeup.com/linux-copy-directory/ "How to Copy a Directory on Linux")
[Linux CommandsHow to use the cp Command 11 min readRead More β](https://pimylifeup.com/cp-command-linux/ "How to use the cp Command")
[UbuntuHow to Install and Use rsync on Ubuntu 9 min readRead More β](https://pimylifeup.com/ubuntu-rsync/ "How to Install and Use rsync on Ubuntu")
## Using the Terminal to Copy files on Ubuntu
By the end of the following sections, you should have a good idea of how you can copy files on Ubuntu. We will cover a few different ways to utilize the cp command, from copying a single file to multiple ones.
### Syntax of the cp command on Ubuntu
Let us start this guide with a quick look at the syntax of the cp command on the Ubuntu operating system.
```
cp [OPTIONS] SOURCE... DESTINATIONCopy
```
- `[OPTIONS]` β The options parameter is entirely optional but allows you to control how this command copies files on your Ubuntu system.
For example, you can get it to create backups of files it overwrites, or you can get it to prompt you when it tries to replace files.
- `SOURCE...` β This command allows you to specify as many files as you want to copy. You can even use wildcards (`*`) to select multiple files that start or end with a certain string.
- `DESTINATION` β The copy command has one weak point: it can only copy files to a single destination. This destination must be the path to which you want the files copied.
- When copying a single file on Ubuntu, you can end the destination with a filename to rename it while copying.
### Copying a Single File on Ubuntu using the Terminal
At its most basic usage, the cp command on Ubuntu allows you to copy a single file to a single destination.
All you need to do to copy a file this way is to specify the β`cp`β command, followed by the name of the file or the path to the file, and finally, a path to the destination.
The destination path does not need to contain the fileβs name, but it will be renamed during copying using that name if it does.
```
cp FILE DESTINATIONCopy
```
#### Example of Copying a Single File
For example, we would use the following command if we wanted to copy a file named β`example.txt`β to the β`/home/pimyubu/`β directory.
```
cp example1.txt /home/piymubu/Copy
```
If we want to copy this file on Ubuntu and change the resulting name, we simply need to specify it at the end of the directory.
For example, if we wanted to copy and rename this file to β`helloworld.txt`β we would use the command below.
```
cp example1.txt /home/pimyubu/helloworld.txtCopy
```
### How to Copy Multiple Files
To copy multiple files at once on Ubuntu, you simply need to specify multiple files when using the cp command.
You can copy as many files as you would like and even use wildcards (`*`) to select files starting, and/or ending with specified characters. If you are unsure what we mean, we will give you an example in the next section.
Just note that while you can copy multiple files at once, you cannot have multiple destinations. Additionally, you canβt rename a file when copying multiple files. The destination must be a path.
```
cp FILE1 FILE2... DESTINATIONCopy
```
#### Example of Copying Multiple Files on Ubuntu
At its most basic usage, you can specify the name of each file that you want to copy to your new directory.
In the following example, we copy β`example1.txt`β and β`example2.txt`β to the β`/home/pimyubu`β directory.
```
cp example1.txt example2.txt /home/pimyubuCopy
```
The cp command on Ubuntu also supports wildcards (`*`), which allows you to copy multiple files with a single command.
For example, if we wanted to copy all files that started with β`example`β and ended with β`.txt`β we would use the following command.
```
cp example*.txt /home/pimyubuCopy
```
### Ask Before Replacing when Copying a File on Ubuntu
When copying files on Ubuntu, you will notice that it can replace any existing files without warning.
Luckily, this command has a built-in feature that allows it to ask you before overwriting files. You will want to use the β`-i`β option to activate the interactive mode.
When using this option, you will have to confirm every time the cp command attempts to overwrite a file.
```
cp -i FILE... DESTINATIONCopy
```
You can also invoke the interactive option using the long-form version: β`--interactive`β.
```
cp --interactive FILE... DESTINATIONCopy
```
#### Example of Asking Before Replacing a File on Ubuntu
To showcase what the interactive option does, let us copy a file that we already have saved within our directory.
We will copy the β`example1.txt`β file into the β`/home/pimyubu`β directory by using following command.
```
cp -i example1.txt /home/pimyubuCopy
```
Using the β`-i`β option, if the file already exists, you will be prompted with a questions asking if you want to replace the file. To overwrite this file, simply type β`y`β and then press the `ENTER` key.
```
cp: overwrite './home/pimyubu/example1.txt'? yCopy
```
### Create a Backup When using Ubuntu to Copy Files
On Ubuntu, it is also possible to copy a file and create a backup of any file the tool goes to overwrite. This is useful when you are unsure if the original file is worth keeping or if you want to revert to the original.
To get the cp command to make a backup of any file it replaces, you should use the β`-b`β option. Backups of files will end with the tilde symbol (`~`).
```
cp -b FILE... DESTINATIONCopy
```
Like the interactive option, you can also write this as β`--backup`β. It achieves the same thing as the β`-b`β option.
```
cp --backup FILE... DESTINATION
```
#### Example of Creating a Backup of Files When Copying Them on Ubuntu
To give you an example of how this works. Copy the file β`example1.txt`β into the β`/home/pimyubu`β directory. This directory is where we copied the text file earlier.
By using the β`-b`β option, the cp command will create a backup of every file that already exists on your Ubuntu system.
```
cp -b example1.txt /home/pimyubuCopy
```
We can now use the [ls command](https://pimylifeup.com/ls-command/) to list the files in our directory.
```
ls -l /home/pimyubuCopy
```
Within this directory, we can see the newly copied file (`example1.txt`), and a backup of the file that got overwritten (`example1.txt~`).
```
-rw-r--r-- 1 pi pi 0 Jan 15 11:59 example1.txt
-rw-r--r-- 1 pi pi 0 Jan 15 11:41 example1.txt~
```
## Conclusion
Hopefully, at this stage in the guide, you will have a good idea of how to copy files on the Ubuntu system.
The cp command makes copying files on a Linux system a straightforward process.
Please feel free to comment below if you have any issues copying files on your system.
If you found this tutorial to be helpful, we recommend you check out our [many other Ubuntu tutorials](https://pimylifeup.com/category/linux/ubuntu/).
## Recommended
[Linux CommandsHow to use the cp Command 11 min readRead More β](https://pimylifeup.com/cp-command-linux/ "How to use the cp Command")
[Linux GuidesHow to Copy a Directory on Linux 4 min readRead More β](https://pimylifeup.com/linux-copy-directory/ "How to Copy a Directory on Linux")
[Linux CommandsHow to use the mv Command 11 min readRead More β](https://pimylifeup.com/mv-command-linux/ "How to use the mv Command")
[UbuntuHow to Remove Files and Directories on Ubuntu 6 min readRead More β](https://pimylifeup.com/ubuntu-remove-file-directory/ "How to Remove Files and Directories on Ubuntu")
[UbuntuHow to Install and Use rsync on Ubuntu 9 min readRead More β](https://pimylifeup.com/ubuntu-rsync/ "How to Install and Use rsync on Ubuntu")
[UbuntuHow to Copy and Paste in the Ubuntu Terminal 4 min readRead More β](https://pimylifeup.com/ubuntu-terminal-copy-paste/ "How to Copy and Paste in the Ubuntu Terminal")
### Leave a Reply [Cancel reply](https://pimylifeup.com/ubuntu-copy-files/#respond)
## Search
Pi My Life Up
Β© 2026 Pi My Life Up
### Links
- [Disclaimer & Privacy Policy](https://pimylifeup.com/disclaimer-privacy-policy/)
- [About Us](https://pimylifeup.com/about-us/)
- [Contact](https://pimylifeup.com/contact/)
### Connect With Us
[Back to Top](https://pimylifeup.com/ubuntu-copy-files/)
Γ
###
Γ
###
Loading...
Γ
### |
| Readable Markdown | In this quick guide, we will be showing you how to copy files on the Ubuntu operating system while using the terminal.

Knowing how to copy a file on Ubuntu is a super important skill to learn, especially if you plan on using the terminal.
On the desktop variant of Ubuntu, this is as simple as opening up the file explorer, clicking a file, and pressing `CTRL` + `C` to copy and then `CTRL` + `V` to paste.
Copying and pasting using the terminal on Ubuntu isnβt any more complicated than on the desktop. In fact, copying is all done with a single simple but powerful command.
This command we are talking about is the [cp command](https://pimylifeup.com/cp-command-linux/). Over the following sections, we will show you how to utilize this command to copy files. You will quickly see that it is easy to remember and easy to use.
As a bonus, if you learn the copy command for one Linux operating system, you can use it on basically any operating system.
By the end of the following sections, you should have a good idea of how you can copy files on Ubuntu. We will cover a few different ways to utilize the cp command, from copying a single file to multiple ones.
### Syntax of the cp command on Ubuntu
Let us start this guide with a quick look at the syntax of the cp command on the Ubuntu operating system.
```
Copy
```
- `[OPTIONS]` β The options parameter is entirely optional but allows you to control how this command copies files on your Ubuntu system.
For example, you can get it to create backups of files it overwrites, or you can get it to prompt you when it tries to replace files.
- `SOURCE...` β This command allows you to specify as many files as you want to copy. You can even use wildcards (`*`) to select multiple files that start or end with a certain string.
- `DESTINATION` β The copy command has one weak point: it can only copy files to a single destination. This destination must be the path to which you want the files copied.
- When copying a single file on Ubuntu, you can end the destination with a filename to rename it while copying.
### Copying a Single File on Ubuntu using the Terminal
At its most basic usage, the cp command on Ubuntu allows you to copy a single file to a single destination.
All you need to do to copy a file this way is to specify the β`cp`β command, followed by the name of the file or the path to the file, and finally, a path to the destination.
The destination path does not need to contain the fileβs name, but it will be renamed during copying using that name if it does.
```
Copy
```
#### Example of Copying a Single File
For example, we would use the following command if we wanted to copy a file named β`example.txt`β to the β`/home/pimyubu/`β directory.
```
Copy
```
If we want to copy this file on Ubuntu and change the resulting name, we simply need to specify it at the end of the directory.
For example, if we wanted to copy and rename this file to β`helloworld.txt`β we would use the command below.
```
Copy
```
### How to Copy Multiple Files
To copy multiple files at once on Ubuntu, you simply need to specify multiple files when using the cp command.
You can copy as many files as you would like and even use wildcards (`*`) to select files starting, and/or ending with specified characters. If you are unsure what we mean, we will give you an example in the next section.
Just note that while you can copy multiple files at once, you cannot have multiple destinations. Additionally, you canβt rename a file when copying multiple files. The destination must be a path.
```
Copy
```
#### Example of Copying Multiple Files on Ubuntu
At its most basic usage, you can specify the name of each file that you want to copy to your new directory.
In the following example, we copy β`example1.txt`β and β`example2.txt`β to the β`/home/pimyubu`β directory.
```
Copy
```
The cp command on Ubuntu also supports wildcards (`*`), which allows you to copy multiple files with a single command.
For example, if we wanted to copy all files that started with β`example`β and ended with β`.txt`β we would use the following command.
```
Copy
```
### Ask Before Replacing when Copying a File on Ubuntu
When copying files on Ubuntu, you will notice that it can replace any existing files without warning.
Luckily, this command has a built-in feature that allows it to ask you before overwriting files. You will want to use the β`-i`β option to activate the interactive mode.
When using this option, you will have to confirm every time the cp command attempts to overwrite a file.
```
Copy
```
You can also invoke the interactive option using the long-form version: β`--interactive`β.
```
Copy
```
#### Example of Asking Before Replacing a File on Ubuntu
To showcase what the interactive option does, let us copy a file that we already have saved within our directory.
We will copy the β`example1.txt`β file into the β`/home/pimyubu`β directory by using following command.
```
Copy
```
Using the β`-i`β option, if the file already exists, you will be prompted with a questions asking if you want to replace the file. To overwrite this file, simply type β`y`β and then press the `ENTER` key.
```
Copy
```
### Create a Backup When using Ubuntu to Copy Files
On Ubuntu, it is also possible to copy a file and create a backup of any file the tool goes to overwrite. This is useful when you are unsure if the original file is worth keeping or if you want to revert to the original.
To get the cp command to make a backup of any file it replaces, you should use the β`-b`β option. Backups of files will end with the tilde symbol (`~`).
```
Copy
```
Like the interactive option, you can also write this as β`--backup`β. It achieves the same thing as the β`-b`β option.
```
```
#### Example of Creating a Backup of Files When Copying Them on Ubuntu
To give you an example of how this works. Copy the file β`example1.txt`β into the β`/home/pimyubu`β directory. This directory is where we copied the text file earlier.
By using the β`-b`β option, the cp command will create a backup of every file that already exists on your Ubuntu system.
```
Copy
```
We can now use the [ls command](https://pimylifeup.com/ls-command/) to list the files in our directory.
```
Copy
```
Within this directory, we can see the newly copied file (`example1.txt`), and a backup of the file that got overwritten (`example1.txt~`).
```
```
## Conclusion
Hopefully, at this stage in the guide, you will have a good idea of how to copy files on the Ubuntu system.
The cp command makes copying files on a Linux system a straightforward process.
Please feel free to comment below if you have any issues copying files on your system.
If you found this tutorial to be helpful, we recommend you check out our [many other Ubuntu tutorials](https://pimylifeup.com/category/linux/ubuntu/). |
| Shard | 167 (laksa) |
| Root Hash | 5933567309854092967 |
| Unparsed URL | com,pimylifeup!/ubuntu-copy-files/ s443 |