windows sftp upload files by using the command line to linux cmd

We asked: What sftp that?

sftp is an interactive file transfer program. It is similar to ftp, but it is encrypted transmission, higher than the FTP security. Below a brief introduction on how to connect a remote host, upload and download files, as well as some related operations.

 

Second question: How to use?

For example, as it is 192.168.14.128 IP remote host or domain www.afeige.cn, the user name is yangyufei, in command-line mode: sftp [email protected] or [email protected]. Enter password prompt. enter

 

 

If the remote machine is not intended landing upload and download files, but to modify certain files on the remote host. can

ssh [email protected] (actually the ssh sftp is a program.)

 

 

 

 

Three questions: you want to do?

 The files in the remote host / home / www directory: download.txt, download the test file in the windows folder in the local disk E

sftp> get /home/www/download.txt E:/test/

This statement will be downloaded to the local E test.text remote host / home / www / directory from: under / test / directory.

 

 

 

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

The windows local E disk test folder under upload.txt file uploads down to the remote host / home files in the directory www / (if uploads folder to add parameters -r)

#上传单个文件
sftp> put E:/test/upload.txt /home/www/
#上传整个文件夹
sftp> put -r E:/test /home/www/

第一条语句将把本地E盘test文件夹目录下的 upload.txt文件上传至远程主机/home/www目录下。

第二条语句将把本地E盘test文件夹目录件上传至远程主机/home/www目录下。

你如果不知道远程主机的目录是什么样, pwd命令可以帮您查询远程主机的当前路径。

查询本机当前工作目录 lpwd.

改变路径可以用cd ,

改变本机路径可以用 lcd;

ls rm rmdir mkdir 这些命令都可以使用。同理调用本机都是加 l , 即 lls lrm.

要离开sftp,用exit 或quit、 bye 均可。

详细情况可以查阅 man  sftp.

如果觉得在命令行模式下不太方便,可以 sudo apt-get install gftp。在图形界面下操作就简便多了。

 

     SFTP命令汇总
                  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                        显示协议版本

 

 

 

 

 

 

人生犹如负重致远,不可急于求成。 自律使人自由!

Guess you like

Origin www.cnblogs.com/afeige/p/12144296.html