admin 管理员组文章数量: 1087139
2024年6月4日发(作者:jquery 选择器 如果没有 选择其他)
如何将本地pc上的文件通过sftp上传到linux服务器
如何将linux服务器上的文件下载到本地pc上
SecureCRT 工具:
1、 打开会话窗口
2、 设置服务器设置本地PC的目录
这个地址用于将该目录下的文件进行上传到linux服务器或把linux上的文件下载到该目
录下
3、 打开sftp窗口(或者使用Alt+P快捷键打开sftp窗口)
4、 在sftp窗口执行命令help,查看sftp可使用的命令
sftp> help
Available commands:
ascii Set transfer mode to ASCII (设置文件传输模式为ascii)
binary Set transfer mode to binary(设置文件传输模式为二进制)
cd path Change remote directory to 'path' (这个就不用说了吧~ )
detail remote-path Display system information about remote
file or folder(查看远程服务器上的文件夹详细信息咯)
例子
sftp> detail ~/huqin
/home/mmap/huqin:
Type: Directory
Size: 280
uid/gid: 500/500
uid/gid: 500/500
Last Modification Time: October 16, 2014 10:35:28
Last Access Time : October 16, 2014 10:36:18
Permissions: drwxrwxr-x
sftp>
ldetail local-path Display system information about local
file or folder(查看本地pc上的文件夹详细信息咯)
例子:
C:/Users/Administrator/Desktop/snak:
Type: Directory
Size: 4096
Create Time : October 14, 2014 14:31:54
Last Modification Time: October 16, 2014 10:35:48
Last Access Time : October 16, 2014 10:35:48
File Attributes: no-attributes
Link Count: 1
sftp>
lcd path Change local directory to 'path'(专用于改变本地目录用的喽)
例子:
sftp> lpwd
C:/Users/Administrator/Desktop/snak #当前本地目录
sftp> lcd E:Work #改变本地目录为E:Work
sftp> lpwd #当前本地目录
E:/Work
sftp>
chgrp group path Change group of file 'path' to 'group' (改变path所属的组喽)
chmod mode path Change permissions of file 'path' to 'mode'
(这个也不用说了吧 改变权限w/r/x之类的了)
chown owner path Change owner of file 'path' to 'owner'(改变档案的拥有者咯)
exit Quit sftp
help Display this help text
include filename Include commands from 'filename'
Alternate: < filename
get [-a | -b] remote-path Download file
force ascii (-a) or binary (-b) mode
例子将我的linux服务器的~/testDir下的文件下载到本地pc上
sftp> pwd
/home/mmap
sftp> cd ~/testDir
sftp> pwd
/home/mmap/testDir
sftp> lpwd
C:/Users/Administrator/Desktop/snak
sftp> lls
sftp> get -a testFile #-a :以ascii方式下载 -b:以二进制方式下载
Downloading testFile from /home/mmap/testDir/testFile
100% 283 bytes 283 bytes/s 00:00:00
/home/mmap/testDir/testFile: 283 bytes transferred in 0 seconds (283 bytes/s)
sftp> lls #查看本地目录下多了个文件吧
testFile
sftp>
ln [-s] existingpath linkpath Hardlink / symlink remote file(不说了 就是个普通的链接命令)
ls [options] [path] Display remote directory listing(不说了 就是个ls命令)
lls [options] [path] Display local directory listing(专门查看本地目录而用的啦)
mkdir path Create remote directory(不说了 就是个创建文件夹命令)
lmkdir path Create local directory (专门创建本地目录而用的啦)
mv oldpath newpath Move remote file
open [user@]host[:port] Connect to remote host
put [-a | -b] local-path Upload file
force ascii (-a) or binary (-b) mode
例子:将本地pc上的文件以ascii方式上传到我的linux服务器的~/testDir下
sftp> pwd #查看当前服务器路径
/home/mmap
sftp> cd ~/testDir #进入要上传到服务的路径
sftp> pwd
/home/mmap/testDir
sftp> lpwd #查看当前本地pc的路径
C:/Users/Administrator/Desktop/snak
sftp> lls #查看本地pc路径下的文件
sftp> put -a
#这里没有指定的路径,因为会话窗口中已经配置了这个路径
Uploading to /home/mmap/testDir/
100% 0 bytes 0 bytes/s 00:00:00
sftp> put -a C:/Users/Administrator/Desktop/snak/
Uploading to /home/mmap/testDir/
100% 0 bytes 0 bytes/s 00:00:00
sftp> ls -l w* c* #查看服务器下文件上传成功否
-rw-rw-r-- mmap mmap 0 Oct 14, 2014 14:32
-rw-rw-r-- mmap mmap 0 Oct 14, 2014 14:32
sftp>
pwd Display remote working directory
lpwd Print local working directory
quit Quit sftp
rmdir path Remove remote directory
lrmdir path
rm path
lrm path
su username
type [transfer-mode]
view remote-path
version
Remove local directory
Delete remote file
Delete local file
Substitutes the current user
This is only supported with VShell for
Windows 3.5 or later.
Display or set file transfer mode(查看文件传输方式ascii或二进制)
Download and open file
Display protocol version
版权声明:本文标题:sftp的使用-本地与远程服务器之间的文件传输 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/b/1717488855a707677.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论