天天看点

linux下使用sftp最简单的命令

来源:http://www.weiruoyu.cn/?p=418

环境:

A机器sftp到B机器上,

任务:

上传A机器D盘上a.txt到B机器/var/tmp目录里

下载B机器/var/tmp下b.txt到A机器的D盘上。

0.登录sftp的两种方法

1)命令登录

[root@localhost tmp]# sftp 192.168.229.169

Connecting to 192.168.229.169...

The authenticity of host '192.168.229.169 (192.168.229.169)' can't be established.

RSA key fingerprint is e1:c2:59:bb:1d:7a:48:4f:16:e8:d3:ff:64:55:90:88.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.229.169' (RSA) to the list of known hosts.

[email protected]'s password:

sftp>

2)SecureCRT软件登录

linux下使用sftp最简单的命令

1.切换A机器目录

sftp> lcd d:\

2.切换B机器目录

sftp> cd /var/tmp

3.拷贝A机器D盘上a.txt到B机器/var/tmp目录里

sftp> put a.txt .

“.”代表当前目录

查看上传了不

sftp> ls

1.txt a.txt ssh_change

sshd_config.bak test

4.下载B机器/var/tmp下b.txt到A机器的D盘上。

sftp> get b.txt

更详细的请参考:http://www.weiruoyu.cn/?p=418

---------------------------------------------------------

linux下使用SFTP命令摘记:

sftp> help

可用命令:

cd 路径 更改远程目录到“路径”

lcd 路径 更改本地目录到“路径”

chgrp group path 将文件“path”的组更改为“group”

chmod mode path 将文件“path”的权限更改为“mode”

chown owner path 将文件“path”的属主更改为“owner”

exit 退出 sftp

help 显示这个帮助文本

get 远程路径 下载文件

ln existingpath linkpath 符号链接远程文件

ls [选项] [路径] 显示远程目录列表

lls [选项] [路径] 显示本地目录列表

mkdir 路径 创建远程目录

lmkdir 路径 创建本地目录

mv oldpath newpath 移动远程文件

open [用户@]主机[:端口] 连接到远程主机

put 本地路径 上传文件

pwd 显示远程工作目录

lpwd 打印本地工作目录

quit 退出 sftp

rmdir 路径 移除远程目录

lrmdir 路径 移除本地目录

rm 路径 删除远程文件

lrm 路径 删除本地文件

symlink existingpath linkpath 符号链接远程文件

version 显示协议版本

继续阅读