SCP (Secure Copy)

scp is a command for sending files over SSH. This means you can copy files between computers, say from your Raspberry Pi to your desktop or laptop, or vice-versa.

First of all, you'll need to know your Raspberry Pi's IP address.

Copying files to your Raspberry Pi

Copy the file myfile.txt from your computer to the pi user's home folder of your Raspberry Pi at the IP address with the following command:

scp myfile.txt pi@

Copy the file to the /home/pi/project/ directory on your Raspberry Pi (the project folder must already exist):

scp myfile.txt pi@

Copying files from your Raspberry Pi

Copy the file myfile.txt from your Raspberry Pi to the current directory on your other computer:

scp pi@ .

Copying multiple files

Copy multiple files by separating them with spaces:

scp myfile.txt myfile2.txt pi@

Alternatively, use a wildcard to copy all files matching a particular search with:

scp *.txt pi@

(all files ending in .txt)

scp m* pi@

(all files starting with m)

scp m*.txt pi@

(all files starting with m and ending in .txt)

Filenames with spaces

Note that some of the examples above will not work for file names containing spaces. Names like this need to be encased in quotes:

scp "my file.txt" pi@