Low Orbit Flux Logo 2 D

Linux - How to Transfer Files Over SSH

Transferring files over SSH is easy. It is also secure. This is usually what you should be using unless you want to set up a file share ( useful to mount a project in a development environment ).

To transfer files over SSH on Linux, use the SCP command.

The basic format of the command looks like this:

scp <source> <destination>

Copy a file from your local system to a remote server like this:

scp /home/user1/file.html user1@server1:/var/www/html

You can copy a file from the remote server to your local system like this:

scp user1@server1:/var/www/html/file.html /home/user1

If you want to copy a directory, you should use the ‘-r’ flag to make the copy recursive like this:

scp -r /home/user1/images user1@server1:/var/www/html

You might want to copy a file between two remote systems, as two different users, like this:

scp -r steve@server1:/home/steve/data.txt greg@server2:/home/greg/

You can also use these:

If you are using a Windows client for some reason, you can use WinSCP. You can find it here: WinSCP.