This guide is a high level overview of how to send files over a serial line between two UNIX machines. This guide is targetted towards moving files to a UNIX system that does not have network access; either due to lack of drivers or a TCP/IP stack.
This guide will provide to two methods; using the cat command and the TTY device file and using UUCP's cu (call unix) command.
The following naming convention will be used in this document.
In both cases, it is best that the files being transferred are first encoded with a tool that is available on both machines. These examples will use uuencode and uudecode.
In the case where both UNIX machines are virtual machines, we assume that a tool like socat is used to link the two VMs together. In the example below, two VM's serial ports have been exported to network ports and linked together using socat.
Example:
QEMU command line fragment:
-serial tcp::3800,server,nowait
socat command line:
socat tcp:vm_server:3800 tcp:vm_server:3900
Binary files must be converted to a plain text encoding that that the TTY drivers will not crash or corrupt the data. It is also good practice to encode plain files as well.
The uuencode command will do this conversion and save it to a file called /tmp/file1.uu in the code block below. The 2nd file1 in the command is the filename that will be uu file will be coverted to when it is decoded.
uuencode file1 file1 > /tmp/file1.uu
This command will decode the file1.uu file and save the results as file1.
uudecode file1.uu
In these examples, /dev/tty01 is direct serial line between the two machines. They are same port on both machines. In this example, we want to pull /tmp/file2.uu from the server and put it on the client.
We assume that /tmp/file2.uu is a uuencoded file.
Step 1: Encode the file
server:
uuencode /tmp/file1 file1 > /tmp/file1.uu
Step 2: Start a listening session on the client.
client:
cat < /dev/tty01 > /tmp/file2.uu
Step 3: Send the file to the client by sending the contents of /tmp/file2.uu to /dev/tty01.
server:
cat /dev/tty01 > /tmp/file2.uu
Once the prompt on server has come back, press Control-C on the client to end the listening session.
Step 4. Unencode the file
client:
cd /tmp
uudecode file2.uu
Tru64 5.0A has a good user manual for using cu/tip. Tru64 5.0's UUCP Networking Commands
Another method is to use UUCP's cu(call unix) command to connect to the other system and then use cu's put and take commands to push and pull files from it. This requires configuring the server's serial port as a serial terminal. This is OS-specific and will not be covered in this general guide. It will be converted in the OS-specific guides elsewhere on this site.
Step 1. Configure the server's serial port as a serial terminal.
Step 2. On the client, run the cu command with -l option for a direct connection. if this option is not provided, file transfers will not work.
cu -l tty01
Step 3. Login to the server.
Step 4. Use the cu's take (copy from server) or put (copy to server) command. Enter ~t (take) or ~p (put) to put them into the required mode.
Enter the filenames when prompted. It is best to provide the full pathname to avoid issues with cu. The files and directories must be readable and writable to the uucp service, which will be running the commands to transfer the files.
An example session is provided below.
server# cd /
server# cd /tmp
server# ~t
Remote file to retreive: /rcconf.uu /tmp/rcconf.uu
Local file name [rcconf.uu]:
[file transfer complete]
[connected]