The uucp command is equivalent to the ordinary cp command, but it transfers files between machines. Thus, in addition to specifying a source filename and a destination filename, you need to specify the name of the computer on which the source file is located and the name of the destination computer.
For example, to copy the file testfile from machine
kate to machine rachel, if the
appropriate permissions are set, you can use the command:
uucp kate!testfile rachel!testfile
The exclamation point (!) separates the host (computer) name from the filename.
Note that, as the exclamation point has special meaning to the C shell,
if you are using the C shell
you must ``escape'' with a backslash (\) any exclamation
points that appear in a uucp command.
For a C-shell user, the command above is specified as:
uucp kate\!testfile rachel\!testfile
The format of the
uucp [options] src_computer!src_file dest_computer!dest_file
For example, to send /usr/andrew/transfile on
your machine kate to /usr/spool/uucppublic
on machine rachel, enter the following command:
uucp /usr/andrew/transfile rachel!~/transfile
This command creates the file /usr/spool/uucppublic/transfile on rachel.
If /usr/andrew is your current directory, you can
copy transfile to alice with the
uucp transfile alice!~/transfile
Another form of the command allows you to specify the full pathname of the copied file on the remote computer. However, you must be sure that your computer has write permission on this directory, otherwise the transfer will fail.
As an example, suppose that you want to send
/usr/andrew/transfile on machine jane to the
/usr/andrew directory on kate.
To do so, enter the following command:
uucp jane!/usr/andrew/transfile kate!/usr/andrew/transfile
The uucp command can be used to retrieve files from
a remote site, in addition to copying files to a remote site.
Using the example above, if you are in the /usr/john
directory on jane and you want to retrieve a copy
of /usr/andrew/transfile from kate,
enter the following command:
uucp kate!/usr/andrew/transfile /usr/john/transfile
You can also use ~user to specify a location
on the remote computer.
The ~user argument is expanded to the pathname
of user's home directory on the remote computer.
For example, suppose /usr/john is the home directory of
account john on machine kate.
To copy transfile from /usr/andrew on jane
to /usr/john on kate,
enter the following command:
uucp /usr/andrew/transfile kate!~john/transfile
The receiving computer expands ~john to the full pathname of john's home directory, creating /usr/john/transfile. Again, your computer must have write permission in john's home directory in order for this transfer to succeed.
With the uucp command, files are not copied and sent immediately. Instead, copies are placed in a spool directory and sent once the uucico daemon awakens. uucico dials remote hosts and transfers the files that it finds queued. Depending on how your system is configured, a uucp transfer might take place within minutes or within hours. It is common for uucp transfers via modem to be saved up for transmission while cheap rate telephone calls are in effect; this is done via a system cron(C) job.
You might be able to send files to a UUCP site that is not connected directly
to your own, that is not listed in
a uuname listing.
For example, your local computer jane
is connected to a UUCP site named kate.
kate is connected to a UUCP site named alice.
You can send /tmp/transfile on your local
computer through jane to /usr/spool/uucppublic
To do this, specify the full UUCP address relative
to your local computer:
uucp /tmp/transfile jane!alice!~/transfile
Note that each site name in the command line is followed by an exclamation mark. By placing several site names in a uucp command line, you can greatly extend the range of systems to which you can copy files with uucp. This is also true for the uuto and uux commands discussed below.
You can use the uustat(C) command to check on the status of files copied with uucp. To check on the status of all your uucp jobs, enter uustat to display the following output:
1234 2/19-10:29 S machine2 mike 9 transfer.fileThe fields are as follows:
COPY FINISHED, JOB DELETED.
Several options are available to use with uustat. Refer to uustat(C) for more information.
The uuto command allows you to copy files to the
public directory of a UUCP site to which your system
The public directory on most UNIX and XENIX® systems
For example, to send a file from the machine
jane to the machine kate, use:
uuto mytextfile kate!john
john is the login of the user to whom you are sending files; john can retrieve mytextfile, as explained in ``Retrieving files from the public directory''.
Before you can send a file with uuto, you must verify that:
(The dot (.) stands for the current directory.)
Files sent with uuto are placed in the directory:
where login is the login of the user to whom you are sending files and src_computer is the site name of your system. In the example above, mytextfile is placed in /usr/spool/uucppublic/receive/john/jane.
As an example, suppose that you want to send a copy of transfile
in /tmp on jane to the user sara
on the machine kate. To do so, enter the following command:
uuto /tmp/transfile kate!sara
This command copies transfile to the following directory:
When the file transfer is complete, the recipient is notified by mail that the file has arrived. If the -m option is used on the uuto command line, the sender is notified by mail of the success or failure of the transfer.
Like uucp, files transferred with uuto are not transferred immediately after the command is entered. Instead, they are placed in a spool directory and sent when the uucico daemon awakens.
In order to retrieve a file sent by uuto, you must
use the uupick command.
To execute uupick, enter a command like this:
uupick -s system
For example, sara would enter uupick -s jane and the uupick program searches the public directory for any files sent to you from system. If it finds any, it responds with the following prompt:
from system src_computer: file filename ?src_computer is the name of the sender's computer and filename is the name of the file transferred. In the example above, if the uuto transfer to sara on kate is successful, sara sees the following uupick prompt:
from system jane: file mytextfile ?Several options are available for responding to the uupick prompt. Two of the most useful are m dir and d. The m dir option tells uupick to move the file to directory dir. Once in dir, you can manipulate the file as you would any other file on your system. In the example above, sara enters the following response to the uupick prompt:
This causes mytextfile to be moved from the public directory to sara's home directory. If no directory is specified after m, the file is moved to the recipient's current directory. The file can then be deleted from the public directory by entering d at the uupick prompt. You can quit uupick by entering q. Other uupick options are available; refer to uupick(C) for a complete list.