Using rz and sz under linux shell

Ah, perhaps by typing the "rz" command at the console, perhaps you were trying to transfer a file via zmodem between two PCs directly from the console via a cross-over serial cable?

I've currently been trying to figure something like this out for myself, so will share what I've got, in-case it's what you were after.

I made two little scripts to help out:

script: "zsend"

#!/bin/sh

DEV=/dev/ttyS0

stty -F $DEV 115200
sz $1 > $DEV < $DEV

script: "zrecv"

#!/bin/sh

DEV=/dev/ttyS0

stty -F $DEV 115200
rz > $DEV < $DEV

Usage Example:

  • Copy these scripts onto both PCs.
  • Alter the "DEV" variable in each script to match your PC's serial device name (eg, for USB-serial ports, it might be "/dev/ttyUSB0")
  • On PC1, type: sudo zsend filename
  • On PC2, type: sudo zrecv

That's worked out for me.


Get to know GNU Screen.

1.install GNU Screen

2.configure Screen by creating a .screenrc file in the root directory.

Write 'zmodem catch' into the .screenrc file.

3.run screen

4.

(1) Send a file from the remote host to the local host:

execute sz FILE from the command line

hit when Screen brings up the default receive command

(2) Send a file from the local host to the remote host

execute rz from the command line

add local filename when Screen brings up the default send command, then hit

Tags:

Linux

Shell