如何通过 SSH 连接从我的 Macbook Pro 上的远程 Linux 计算机复制文件并将文件发送到远程 Linux 计算机?

Rya*_*ard 7 linux ssh macos

使用我的 PC,我只使用了 Tunnelier,它为我处理了所有肮脏的工作。现在我有了一台 MacBook Pro(用于设计目的),我不知道如何将我的文件发送到 Linux 服务器。

任何帮助,将不胜感激。

kfm*_*e04 6

scp pathToFileOnMBP username@linuxHost:pathToFileOnLinux
Run Code Online (Sandbox Code Playgroud)

有用的选项:

-r 递归复制

-P 端口号,如果你想使用 22 以外的端口(标准 ssh)


Joh*_*web 5

rsync 是生意。

rsync -chavz --partial --progress --stats source_files remotehost.domain:target_dir
Run Code Online (Sandbox Code Playgroud)

在哪里:

--checksum             -c              -- skip based on checksums, not mod-time & size                                                                                                                   
--human-readable       -h              -- output numbers in a human-readable format                                                                                                                      
--archive              -a              -- archive mode; same as -rlptgoD (no -H)                                                                                                                         
--verbose              -v              -- increase verbosity                                                                                                                                             
--compress             -z              -- compress file data during the transfer                                                                                                                         
--partial                              -- keep partially transferred files                                                                                                                               
--progress                             -- show progress during transfer                                                                                                                                  
--stats                                -- give some file-transfer stats                                                                                                                                  
Run Code Online (Sandbox Code Playgroud)

rsync 的伟大之处在于它只复制它需要的东西。因此,如果您第二次运行该命令,它应该不会复制任何内容(除非其中一个文件在此期间的任一端发生了更改)。如果您的传输以某种方式中断,这也很有用。上面命令的输出将为您提供一些关于它加速文件传输的信息。