SCP Command and SFTP command

Source: Internet
Author: User
Tags scp file openssh server scp command

SCP
Help command: Man SCP

SCP function: Download remote files or directories to local, if you want to upload or want to download the directory, the best way is to use tar compression, isThe most sensible choice..
Download something from a remote host to a local computer copy File command SCP [email protected]:/path/file/localpath-SCP user name @ip:/file path/local file path
If the copy directory is scp-r [email protected]:/dirpath/localpath i.e. scp-r username @ip:/directory Path/local file path

Upload a file or directory locally to a remote host from a local upload file to a remote host SCP localfile [email protected]:/dirpath that is the SCP file path remote host user name @ip:/the path to the file
Upload directory from local to remote host scp-r localdir [email protected]:/dirpath scp-r Local directory path remote host user name @ip:/store file path

-----------------------------------------------------------------------
Sftp
Sftp> Help for assistance
is an interactive file transfer program. It is similar to FTP, but it is encrypted and has higher security than FTP. Here's a quick introduction.

How to connect the host remotely, upload and download files, and some related actions.
For example, if the IP of the remote host is 202.206.64.33 or domain name www.hebust.edu.cn, the user name is Fyt, in the command line mode: SFTP [email protected] or [email protected] Enter prompt for password. Enter the prompt sftp>

If you log on to the remote machine not to upload the downloaded file,modify some files on a remote host。 can ssh [email protected] (in fact, SFTP is an SSH program.) )
in sftp, get means the download is obtained; put means the path of the file that the upload is placed sftp> get remote host files to the path of the local computer sftp> the path of the put local file saves the file version to the remote host's path



sftp> get/var/www/fuyatao/index.php/home/fuyatao/will download index.php to the local/home/fuyatao/directory from the/var/www/fuyatao/directory of the remote host.

Sftp> put/home/fuyatao/downloads/linuxgl.pdf/var/www/fuyatao/The local/home/fuyatao/downloads/ The linuxgl.pdf file in the directory is uploaded to the remote host/var/www/fuyatao/directory

If you do not know what the remote host directory is, the PWD command can help you query the current path of the remote host. Query native current working directory lpwd.
Change the path can be used CD, change the local path can be used LCD;
LS RM rmdir mkdir These commands are available. The same call native is add L, that is, Lls LRM.
To leave SFTP, use Exit or quit, bye. The man sftp can be consulted in detail.
If you find it inconvenient in command line mode, sudo apt-get install gftp. It's much easier to operate in a graphical interface.
--------------------------------------------------------------
Remember: When using SFTP and FTP, all files and directories have to be entered manually, and the tab complement key is not useful in these two commands. The time to enter carefully!
For example, the operation record on my Computerdownload files from a remote host to your local computersftp> pwdremote working directory:/home/zb/downloadssftp> ls2005.pdf           & nbsp     hotmail                 kla-service-fengxian       lensing                 backup   & nbsp;               file            &nbsp ;      sextractor.pdf            sources                   Xu Xian Graduation thesis          Xu Xian Graduation thesis .tgz    & nbsp;sftp> CD filesftp> pwdremote working directory:/home/zb/downloads/filesftp> Lsdell      & nbsp                               &N Bsp      baijiaxingimage.jpg                              & Nbsp;linux command Introduction. ppt                          &N Bsp   OPENSSH Server manual installation and configuration. PDF             sextractor.pdf                                   &N Bsp SSH login server. ppt                           &N BSP; VI-CN gaoqing.gif                                   vi-engaoqing.gif                &nbs P                 vi-vim-cheat-sheet-cn.png       & nbsp    &nbsp             vi-vim-cheat-sheet.gif                             vi1.jpg         & nbsp                              &N bsp;vim-shortcuts.png.thumb.jpg.png                      vivim_vim-1024x725.png                       & nbsp;     sftp> get vi-vim-cheat-sheet.gif. Fetching/home/zb/downloads/file/vi-vim-cheat-sheet.gif to./vi-vim-cheat-sheet.gif/home/zb/downloads/file/ vi-vim-cheat-sheet.gif                        & nbsp;   100%  155kb154.9kb/s   00:00   sftp> CD. Sftp> Get./file/vim-shorTcuts.png.thumb.jpg.png./201206fetching/home/zb/downloads/./file/vim-shortcuts.png.thumb.jpg.png to./201206/ vim-shortcuts.png.thumb.jpg.png/home/zb/downloads/./file/vim-shortcuts.png.thumb.jpg.png                    100%   44kb 43.7kb/s   00:00   SFTP>&NB Sp
-----------------------------------------------uploading to a remote host from your local computer

SCP Command and SFTP command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.