|
|
Several command strings are available with cu that allow your local computer to communicate with a remote UNIX system. Two of the most useful are take and put.
The take command allows you to take files
from the remote computer to the local computer.
Suppose, for example, that you want to copy a file named
proposal in the current directory of the remote computer
to the /tmp directory on the local computer.
To do so, enter the following command:
~%take proposal /tmp/proposal
Note that you have to prefix a tilde and a percent sign (~%) to the take command, and that the tilde must be placed at the start of a line. For this reason, it is a good idea to press <Enter> before using take.
The put command does the opposite of take.
It puts files from the local computer onto the remote computer.
Suppose, for example, that you want to copy a file named minutes
from the /usr/spool/uucppublic directory on the local computer
to the /tmp directory of the remote computer.
Suppose also that you want the file to be called
minutes.9-18 on the remote computer.
To do so, enter the following command:
~%put /usr/spool/uucppublic/minutes /tmp/minutes.9-18
As with the take command, you have to prefix a tilde and a percent sign (~%) to the put command, with the tilde coming at the beginning of a line.
put and take rely on other programs existing at either end of the connection; put needs stty and cat, while take needs echo and cat. They may not work if you use cu to connect to a computer that does not have these programs (for example, a computer running DOS). put and take can only copy text files; if you want to send a binary file, uuencode it before transmission. (See the Mail and Messaging Guide for an explanation of how to use uuencode and uudecode.)
The cu command cannot detect or correct transmission errors. After a file transfer, you can check for loss of data by running the sum command on both the file that was sent and the file that was received. This command reports the total number of bytes in each file. If the totals match, your transfer was probably successful. See the sum(C) manual page for details.
For example, here is a sample cu session:
#uname
jane #cu rachel
login:
andrew
Password: TERM = (ansi)#
cd /
#lf
.hushlogin autoexec.bat date.dat mnt/ tmp/ .lastlogin autotest* dev/ opt/ u/ .login bin/ dos sc* unix .mailrc boot etc/ sco_extra.ps unix.old .profile command.com hj* server/ usr/ .rhosts config.sys install/ sfmt* var/ .utillist2 core lib/ shlib/ vmstat.dat README country.sys lost+found/ tcb/ #compress README
#uuencode README.Z README.Z>readme.uue
#~%take readme.uue
sh -c "stty -echo;test -r readme.uue&&(echo '~>':readme.u ue;cat readme.uue;echo '~>');stty echo" ~>:readme.uue 1234567+ #~!
#uname
jane #ls message.file
message.file #exit
#uname
rachel #~%put message.file
sh -c "stty -echo;(cat - >readme.uue)||cat - >/dev/null;st ty echo" 12345678901234567+ #exit ~.
#uname
jane #uudecode readme.uue
#uncompress README.Z
#