[Ubuntu] Command to copy files between Linux: scp

scpis the command used on Linux and Unix systems to securely copy files and directories. It uses the SSH protocol for encrypted transmission. The following is scpthe basic syntax and example usage of the command:

  1. Copy files from remote host to local:

    scp 用户名@远程主机:源文件路径 目标路径

    Example:

    scp [email protected]:/path/to/file.txt /local/path/file.txt
  2. Copy files from local to remote host:

    scp 源文件路径 用户名@远程主机:目标路径

    Example:

    scp /local/path/file.txt [email protected]:/path/to/file.txt
  3. To copy a directory and its contents recursively:

    scp -r 用户名@远程主机:源目录路径 目标路径

    Example:

    scp -r [email protected]:/path/to/directory /local/path/directory

These are scpthe basic usage of the command, you can adjust accordingly according to your needs. You can also use the command to view detailed instructions and other options for the command man scpin the terminal .scp

Guess you like

Origin blog.csdn.net/Holenxr/article/details/131507908