Zmodem File Transfer With GNU Screen

I've been using screen as my serial terminal (as opposed to minicom or picocom) for a long time now.  Today I had the need to transfer a file from my PC to the embedded device I was connected to with screen.  Networking was not working, and a co-worker reminded me that zmodem was a way to transfer a file over the serial port.  I googled for instructions on exactly how to use zmodem and I found stack overflow answers and blog entries all mentioning GNU screen for doing so, but none of them really explained it right.  Here's what worked for me today.

To transfer a file from my PC to the embedded device:

  1. in screen hit ctrl-a : zmodem catch
  2. in screen, at the linux command-line on your device type: rz
  3. screen will prompt with an sz command, just append the filename to that command and hit enter

Note that this works best if the file is in the same directory as you ran screen from.

  To send a file from the embedded device to your PC:

  1. in screen hit ctrl-a : zmodem catch
  2. in screen, at the linux command-line on your device type: sz <filename>
  3. screen will prompt with an rz command, just hit enter

You only need to run the zmodem catch command once in your screen session.  In fact, you can just put this at the end of your .screenrc and then you will never have to do step 1 at all:

zmodem catch

Comments

Popular posts from this blog

SystemVerilog Fork Disable "Gotchas"

'git revert' Is Not Equivalent To 'svn revert'

Put /etc Under Revision Control (with git)