linux之文件传输
warning:
这篇文章距离上次修改已过200天,其中的内容可能已经有所变动。
在Linux中,可以使用多种方法进行文件传输,如scp
、rsync
和sftp
等。以下是使用scp
进行文件传输的示例代码:
从本地复制到远程服务器:
scp /path/to/local/file username@remote_host:/path/to/remote/directory
从远程服务器复制到本地:
scp username@remote_host:/path/to/remote/file /path/to/local/directory
在这些命令中,username
是远程服务器上的用户名,remote_host
是远程服务器的地址(可以是IP地址或域名),/path/to/local/file
和/path/to/remote/file
分别是本地文件和远程文件的路径。
注意:在使用scp
之前,确保远程服务器上的SSH服务正在运行,且你有权限访问远程服务器。如果远程服务器使用的是不同的端口号,可以使用-P
参数指定端口号。
评论已关闭