3

I am configuring my raspberry pi device of the serial console (like this https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/overview)

How can I do the equivalent of scp? (copy files to the raspberry pi)

Currently I am just going cat > newfile.py and then pasting in the file content.

Maybe the following matrix will explain what I am missing:

over network                    | over serial
--------------------------------------------------------------
ssh pi@192.168.1.10             | picocom -b 115200 /dev/ttyU*
--------------------------------------------------------------
scp script.py pi@192.168.1.10:~ | ????????????????

additional stuff:

  • I would like to put this in a script, so a non interactive way would be preferable.
  • All of your suggestions sound great.. but an example would be really handy.
Alex028502
  • 149
  • 2
  • 10

2 Answers2

3

There's nothing wrong with your approach for individual text files. For a binary file (or a large number of files/directories which you'd pack together with tar/gzip), you can use base64 to encode them as text:

Receiver (Pi over picocom):

cat | base64 -di > file

Sender (another terminal on the PC):

cat file | base64 > /proc/`pidof picocom`/fd/0

Also note that if you want to try out X/Y/ZMODEM (which will be about 30% faster than gzip/base64), the client in Debian goes by the name lrzsz and can be installed with apt. Other apps with ZMODEM support are cutecom/minicom.

Dmitry Grigoryev
  • 28,277
  • 6
  • 54
  • 147
2

Although old fashioned, Picocom supports filetransfer, x-modem, y-modem, z-modem and ascii-xfr. If I where you, i'd go for z-modem. The package you are looking for is lrzsz (and notzmodem as I stated earlier). Note that it operates a bit different from scp.

Ljm Dullaart
  • 2,539
  • 11
  • 16