服务器与本地之间的数据传输
本地给服务器上传数据
shell
scp /path/to/local_file username@remotehost:/path/to/remote_directory
例如
shell
scp test.txt [email protected]:/test
# test.txt 需要上传到服务器的文件,如果非当前路径,使用文件的相对路径或绝对路径
# /test 服务器上的保存路径
一般情况下,输入后,需要输入服务器密码,才能成功上传文件到服务器
服务器数据下载到本地
shell
scp username@remotehost:/path/to/remote_file /path/to/local_directory
例如
shell
scp [email protected]:/test/test.txt /data
# /test/test.txt 服务器上目标文件路径
# /data 本地的保存路径