Linux scp命令:
Upload to remote :复制本地文件到远程
Part1:
Scp -P port local_file remote_user@remote_ip:remote_file
SCP -P port -r local_dir remote_user@remote_ip:remote_dir # local_dir must exist ,else will occur error
Part2:
Dowmload from remote 复制远程文件到本地
Scp -P port remoet_user@remote_ip:remote_file local_file
Scp -P port -r remote_user @remote_ip:remote_dir local_dir # localdir must exist
Sftp :
Part1:
Sftp remote_user@remote_ip
>> pwd:
>> ls -l remote_dir
>>lls -l
# get file from remote 远程获取文件
>> get remote_file local_file #localfile if exists in local linux will cover it by remote same name file
Eg:
sftp> get /usr/local/test002/2.txt /usr/local/test01/1.txt
Fetching /usr/local/test002/2.txt to /usr/local/test01/1.txt
/usr/local/test002/2.txt 100% 5 5.2KB/s 00:00
sftp> exit
Part2:
>> put local file from local 从本地上传到远程文件
>> put local_file remote_file 上传文件如果远程已存在会直接覆盖掉远程同名文件
Eg:
sftp> put /usr/local/test01/1.txt /usr/local/test002/2.txt
Uploading /usr/local/test01/1.txt to /usr/local/test002/2.txt
/usr/local/test01/1.txt 100% 5 6.3KB/s 00:00