Linux uucp command
Linux uucp(Unix-to-Unix Copy) is a command used on Unix and Linux systems to transfer files between computers.
Although most file transfer tasks today are handled by more modern protocols (such as FTP, SCP, rsync, etc.), uucp it still has its uses in certain specific scenarios.
UUCP is a protocol for linking Unix systems over serial lines; using the UUCP protocol, its main function is to transfer files.
How the uucp command works
uucpThe command manages file transfers through theuucicodaemon. When a user executes theuucpcommand, the system adds the transfer job to a queue, and theuucicodaemon handles the actual transfer.uucicoIt tries to connect to the target system and, once connected, starts transferring files.
Syntax
uucp [选项] 源文件 目标文件
- Source file: the path of the file or directory to transfer.
- Destination file: the file or directory path at the destination.
uucpThe command supports many options; here are some commonly used ones:
-c: do not copy files to a temporary directory before transferring.-C: force files to be copied to a temporary directory.-d: create necessary directories at the destination.-f: overwrite the file if it already exists at the destination.-j: display the job ID.-m: send an email notification after the transfer completes.-n: do not perform the actual transfer; only show the operations that would be performed.-r: recursively copy directories and their contents.
Complete parameter description:
- -c or --nocopy: do not copy files to the buffer.
- -C or --copy: copy files to the buffer.
- -d or --directiories: when transferring files, automatically create necessary directories at [destination].
- -f or --nodirectiories: when transferring files, abort the job if directories need to be created at [destination].
- -g
or --grade specifies the priority of file transfer jobs. - -I
or --config specifies the uucp configuration file. - -j or --jobid: display the job ID.
- -m or --mail: after the job finishes, report by email whether it completed successfully.
- -n
or --notify after the job finishes, report by email to the specified user whether it completed successfully. - -r or --nouucico: do not start the uucico daemon immediately; just put the job in the queue to be executed later.
- -R or --recursive: if [source] is a directory, copy the entire directory including subdirectories to [destination].
- -t or --uuto: treat the last argument as "host!user".
- -v or --version Display version information.
- -W or --noexpand: do not add the current directory to the path.
- -x
or --debug starts the specified debugging mode. - --help Display help.
Example
Transferring a single file
Suppose we have a file example.txt, and we want to transfer it from the local system to the remote system's /home/user/ directory on the remote host, you can use the following command:
uucp example.txt remote!/home/user/example.txt
In this command,remote! represents the name of the remote system,/home/user/example.txt is the destination path.
Transferring an entire directory
If we want to transfer a directory and all its contents, we can use -r Option:
uucp -r mydir remote!/home/user/mydir
This will recursively copy the mydir directory and all its subdirectories and files to the remote system's /home/user/mydir directory.
Overwriting the destination file
If a file with the same name already exists at the destination, we can use the -f option to overwrite it:
uucp -f example.txt remote!/home/user/example.txt
Displaying the job ID
If we want to view the job ID of a transfer task, we can use -j Option:
uucp -j example.txt remote!/home/user/example.txt
After running this command, the system returns a job ID, which we can use to query the transfer status.
Limitations of the uucp command
Although uucp The command is still useful in some scenarios, but it also has some limitations:
- Slow speed: Because
uucpIt was originally designed for low-speed serial lines, so its transfer speed is relatively slow. - Lower security:
uucpTransferred files are usually not encrypted, so in modern network environments it is more recommended to use more secure protocols (such as SCP or SFTP). - Complex configuration:
uucpIt requires configuring multiple files and parameters, which can be complicated for beginners.
Linux Command Reference