【问题标题】:What is the source and destination in the following scp command?以下 scp 命令中的源和目标是什么?
【发布时间】:2017-03-23 05:14:17
【问题描述】:

我正在尝试将文件从一个 Linux 系统复制到另一个 Linux 系统。我对scp 的尝试是否正确?此命令中的源和目标是什么

scp -r ~/setup ashok@192.168.5.223: ~/

?

【问题讨论】:

  • ~/setup 是源,ashok@192.168.5.223: ~/ 是目标(即远程主机上的~/
  • 在类似 UNIX 的系统上,任何命令都带有手册页。请阅读!
  • 我 +1 了这个问题,因为它对我来说很有用。在 CentOS 7 上, scp 的手册页没有说明哪个参数是源,哪个是目标。它说的是以下内容:...not typing the entire thing... [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2 它看起来像这里的那个,但没有(我所看到的)一堆额外的空格:linux.die.net/man/1/scp 知道哪个是源哪个是目的地很重要,尤其是当程序覆盖现有文件时...

标签: linux data-transfer


【解决方案1】:

基本语法

scp source_file_name username@destination_host:destination_folder

你的情况

~/setup : is the source [~ : root directory and setup is a folder which you want to copy to a destination]

ashok@192.168.5.223: is the destination 
~/: location in a destination [in this case which is a root directory]

要了解更多请点击以下链接

http://www.hypexr.org/linux_scp_help.php

【讨论】:

    【解决方案2】:

    这个问题更适合unix.stackexchange

    这里,home 目录(在您正在执行此命令的机器上)中名为 setup 的文件是源,而机器 ashok@192.168.5.223 上的 home 目录是目标。这是一个复制命令,它不会 move(您将保留原始副本),所以如果这是您想要的,那么您可以使用 scp 命令。

    【讨论】:

    • 但是当我从 ashok@192.168.5.223 主目录复制到我的主目录执行此查询时
    • @user7750849 请参阅man7.org/linux/man-pages/man1/scp.1.htmllinux.die.net/man/1/scp。您应该做的第一件事是执行man scpscp help
    • @0xc0de:正如 Pulseczar 在对该问题的评论中指出的那样,手册页没有说明 host1 或 host2 中的哪一个是源或目标。
    猜你喜欢
    • 2014-09-12
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 2020-09-06
    • 2011-07-16
    • 2014-01-15
    • 2012-08-11
    相关资源
    最近更新 更多