By Hester / Last Updated August 5, 2022

How do I move a file using SCP?

“I occasionally need to move files across PCs. I tried a variety of different file transmission methods, but I always had problems. For instance, the size of the files makes them impossible to send, or the unstable connection causes the transmit session to abruptly end. In addition, I worry about data loss every time. My friend says I might be able to copy files safely using SCP. Is there anybody to give me some tips on how do I move a file using SCP?”

transfer files using scp command

How to achieve SCP file transfer

SCP (Secure Copy Protocol) is a command-line utility that enables you to securely transfer files from PC to PC. In this part, we provide you with detailed SCP command for file transfer in three different cases.

Here are some basic SCP command syntax and options you need to know.

The SCP command syntax is presented in the following form:

scp [OPTION] [[email protected]]SRC_HOST:]file1 [[email protected]]DEST_HOST:]file2

  • [OPTION]-Options are used to perform SCP-related tasks, such as installing, configuration, copy, etc.
  • [[email protected]]SRC_HOST:]file1 - Source file.
  • [[email protected]]DEST_HOST:]file2 - Destination file
Tips: While remote file names should contain a user and host specification, local files should be indicated using an absolute or relative path.

SCP offers a wide range of options that regulate every facet of its activity. The following are the most common ones:

  • ✍-P- Specifies the remote host ssh port.
  • ✍-p- Preserves file modification and access times.
  • ✍-q- Use this option if you want to suppress the progress meter and non-error messages.
  • ✍-C- Forces SCP to compress the data as it is sent to the destination machine.
  • ✍-r- Asks SCP to copy directories recursively.

Read the notes carefully before your operations.

Notes:
  • Linux and Mac both include the SCP command. If you use Windows, you need to download and install PuTTY or copy "pscp.exe" (SCP for Windows) into the target folder where you intend to use it.
  • The SCP command requires authentication with an SSH key or password on the remote systems since it relies on SSH (Secure Shell) tunnel to transfer data.
  • When copying files with the same name and location on both systems, take caution because SCP will automatically overwrite files.
  • To copy files, you must at least have read permission on the source file and write permission on the target system.

Case 1. Transfer a local file to a remote computer with SCP

Step 1. Run the following command to copy a local file to a remote computer:

scp file.txt [email protected]:/remote/directory

  • file.txt - the name of the target file you want to transfer
  • remote_username - the username of the remote device
  • 10.10.0.2 - replace it with the IP address
  • /remote/directory - the path you want to copy the file to (If no remote directory is supplied, the file will be copied to the remote user's home directory.)

transfer from local to remote scp

Step 2. Enter the user password to start the process.

Bonus Tip:

Run the command below to specify a new file name if you want to save the file with a different name:

scp file.txt [email protected]:/remote/directory/newfilename.txt

Case 2. Use SCP to transfer a remote file to a local system

Step 1. Replace the similar information in Case 1 and run the command to transfer files from remote to local:

scp [email protected]:/remote/file.txt /local/directory

transfer from remote to local scp

Step 2. Enter the password to perform the task.

Case 3. Transfer a file between two remote computers via SCP

Step 1. Enter the following command to copy a file between two remote systems.

scp [email protected]:/files/file.txt [email protected]:/files

  • /files/file.txt- name of the target file
  • host1.com- the host you transfer files from
  • /files - the directory you want to copy files to
  • host2.com - the target host you want to transfer files to

transfer between remote systems scp

Step 2. Enter the password of both devices and the file will be directly transferred.

Notes: The SCP file transfer speed is a distinguished drawback that the users complain about most. According to user feedback, to transfer files from one computer to another, it takes about 25 minutes to send 500 Mb of a file using SCP. Besides, it requires certain technical knowledge to transfer files via SCP, otherwise, you will get errors when running the command.

AnyViewer: Transfer files between Windows PCs in simpler steps

Due to the limitation mentioned above, you may seek an easier way to transfer files between computers. Here we recommend you to use third-party software AnyViewer for the following benefits.

Easy-to-use. It has a simple interface and easy operations to transfer files without limitations.
Fast. It has a fast file transfer speed, for example, it only costs about 20 seconds to transfer a 2 GB zip file when both computers are on LAN.
Compatible. It supports several Windows versions, including Windows OS and Windows Server OS.
Multi-function. In addition to file transfer, AnyViewer also allows you to share screen, manage your computer remotely, communicate via chat box in a remote session, etc.
Unattened. It offers unattended remote access to PCs and laptops without complicated settings.
Download Freeware Win 11/10/8.1/8/7
Secure Download

Step 1. On the client computer, go to Log in on the left pane and then click Sign up (you can log in directly if you have already signed up).

log in anyviewer

Tips: AnyViewer also supports iOS devices. You can remotely access Windows PC from iPhone or iPad.

Step 2. Fill in the sign-up information.

sign up for anyviewer

Step 3. Log in to the same account on other devices. Then you can see the assigned devices.

free editions

Step 4. Go to the Device interface to select the target device you want to transfer files to, and then click File Transfer.

file transfer anyviewer

Step 5. A File Transfer dialog box for transferring files between the PCs is now available. The right of the box presents the client PC, and the host PC is on the left. Select the files and click the right arrow to transfer them to the client PC. Select the files and then click the left arrow to transfer them to the host PC.

choose files

You can see the transfer status at the bottom of the box. Right-click to pause or remove the tasks.

transfer status

Notes:enlightened...
A single file smaller than 100 MB can be transferred using AnyViewer's free account, and you are only permitted to transfer up to 100 files at once. To transfer larger files, upgrade to a Professional or Enterprise plan. The following rights will thereafter be yours:
Transfer multiple files all at once.
Speedier file transfer. Transfer speed for a free account is 500 KB/s, but it can reach 10 MB/s for a paid account.
Assign more devices to the same account to achieve direct file transfer.
Connect to the host computer in privacy mode so that you can block the remote PC's keyboard and mouse and black its screen.

Conclusion

This post is a stepwise tutorial on SCP file transfer. Some may grasp the methods and have transferred files successfully between computers via SCP. However, some may feel confused about the complicated command, in this case, we also recommend another file transfer tool. Therefore, if you want to transfer files in simple steps, try AnyViewer.