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 [email protected]:

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

scp myfile.txt [email protected]:project/

Copying files from your Raspberry Pi

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

scp [email protected]:myfile.txt .

Copying multiple files

Copy multiple files by separating them with spaces:

scp myfile.txt myfile2.txt [email protected]:

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

scp *.txt [email protected]:

(all files ending in .txt)

scp m* [email protected]:

(all files starting with m)

scp m*.txt [email protected]:

(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" [email protected]: