Linux uucp Command

Linux 命令大全Linux Command Encyclopedia

Linux uucp(Unix-to-Unix Copy) is a command used in Unix and Linux systems to transfer files between computers.

Although most file transfer tasks are now accomplished through more modern protocols (such as FTP, SCP, rsync, etc.),uucpit still has its uses in certain specific scenarios.

UUCP is a protocol that connects Unix systems via serial lines. Using the UUCP protocol, its main function is to transfer files.

How the uucp Command Works

uucpThe command, throughuucicodaemon manages file transfers. When a user executesuucpcommand, the system queues the transfer task, and theuucicodaemon is responsible for the actual transfer work.uucicoIt will attempt to connect to the target system and start transferring files once the connection is successful.

Syntax

uucp [选项] 源文件 目标文件
  • Source file: The path of the file or directory to be transferred.
  • Target file: The file or directory path at the target location.

uucpThe command supports various options; the following are some commonly used options:

  • -c: Do not copy the file to a temporary directory before transferring it.
  • -C: Force the file to be copied to a temporary directory.
  • -d: Create necessary directories at the target location.
  • -f: If the target file already exists, overwrite it.
  • -j: Display the job ID.
  • -m: Send an email notification after the transfer is complete.
  • -n: Do not perform the actual transfer operation; only display the operations that will be performed.
  • -r: Recursively copy the directory and its contents.

Complete Parameter Description:

  • -c or --nocopy Do not copy the file to the buffer.
  • -C or --copy Copy the file to the buffer.
  • -d or --directiories Automatically create necessary directories at the [destination] when transferring files.
  • -f or --nodirectiories When transferring files, if a directory needs to be created at the [destination], abandon the job.
  • -g<level> or --grade<level> Specify the priority order of file transfer jobs.
  • -I<config file> or --config<config file> Specify the uucp configuration file.
  • -j or --jobid Display the job number.
  • -m or --mail After the job is completed, report by email whether the job was completed successfully.
  • -n<user> or --notify<user> After the job is completed, report by email to the specified user whether the job was completed successfully.
  • -r or --nouucico Do not start the uucico service program immediately; only send the job to the queue and execute it later.
  • -R or --recursive If the [source] is a directory, copy the entire directory including subdirectories to the [destination].
  • -t or --uuto Treat the last parameter as "hostname!user".
  • -v or --version Display version information.
  • -W or --noexpand Do not add the current directory to the path.
  • -x<type> or --debug<type> Start the specified debugging mode.
  • --help Display help.

Examples

Transfer a Single File

Suppose we have a fileexample.txt, and we want to transfer it from the local system to the remote system's/home/user/directory. We 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.txtis the target path.

Transfer an Entire Directory

If we want to transfer a directory and all its contents, we can use the-roption:

uucp -r mydir remote!/home/user/mydir

This will recursively copy themydirdirectory and all its subdirectories and files to the remote system's/home/user/mydirdirectory.

Overwrite the Target File

If a file with the same name already exists at the target location, we can use the-foption to overwrite it:

uucp -f example.txt remote!/home/user/example.txt

Display Job ID

If we want to view the job ID of the transfer task, we can use the-joption:

uucp -j example.txt remote!/home/user/example.txt

After executing this command, the system will return a job ID, which we can use to query the transfer status.


Limitations of the uucp Command

Although theuucpcommand is still useful in some scenarios, it also has some limitations:

  • Slower Speed: Becauseuucpwas originally designed for low-speed serial lines, 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 may be relatively complex for beginners.

Linux 命令大全Linux Command Encyclopedia

Other Extensions