Serverspace Technologies in the UAE: Launch of Falconcloud
October 18, 2023
Updated February 19, 2024

Copying files on Linux


Copying files is an important task when working on the Linux operating system. In it, copying files and folders can be done in different ways, and each one has its own characteristics and advantages for increasing productivity and efficiency. In this article we will list some methods for copying files and folders that will help you successfully complete this task.


One commonly used method for copying files is the cp command. Its syntax is simple and clear:

cp [parameters] <source> <destination>

To copy the testfile from the current directory to the /home/testuser directory, simply run the following command:

cp testfile /home/testuser/

If you need to copy a file with a new name, simply specify the desired name in the destination argument:

cp testfile /home/testuser/newfile

List of useful command keys:

  • -r recursive copying of folders and their contents;
  • -p save file attributes, such as creation date, owner, access rights;
  • -v to display detailed information about the copying process.


One of the significant advantages of rsync is the ability to continue copying if it is interrupted. This is especially useful when copying large files or when working over a network.

rsync [options] <source> <destination>

Installing rsync:

apt install && apt upgrade -y
apt install rsync

Example usage for copying the testfile.txt file to the /home/testuser directory:

rsync testfile.txt /home/testuser/

Using the scp command to copy files over the network

The scp command allows you to copy files between different systems over a network. Its syntax is similar to cp:

scp [parameters] <source> <destination>

An example of using the scp command to copy a file.txt file from a remote server to the local computer:

scp testuser@remote:/path/to/testfile.txt /local/path/

The scp command also allows you to copy files between remote servers:

scp testuser@remote1:/path/to/testfile.txt username@remote2:/path/to/

The scp command options allow you to configure authentication, secure connection, and other settings.


Copying files on Linux is one of the main tasks when working with this operating system. We looked at several methods, including the cp command for copying files locally, rsync for advanced capabilities, and scp for copying files over a network. You can choose the most suitable method depending on your needs and requirements. It should also be noted that all these commands have many options that allow you to customize the copying process in a way that suits you. For more information about these options, you can refer to the documentation available on the Linux system.

4 out of 5
Аverage rating : 4
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.