Linux SFTP usage (implementation file upload download)

Source: Internet
Author: User
Tags symlink ssh ssh config ssh config file

FTP are probably all used, SFTP used estimates are relatively few. Simply put, it is a secure before FTP, through the SSH channel between the local and remote server file transfer, more secure.

Connection

This is usually the case for SSH connections:

SSH sam@zfanw.com

then enter the password.

Sftp basically is to change ssh for SFTP:

SFTP sam@zfanw.com

If you have an SSH config file configured, it is simpler to connect to a remote server in the form of a private/public key:

SFTP Linode

When the connection is complete, the terminal displays:

SFTP >

Download files

The main function of FTP is file transfer, SFTP provides the download file command is get:

Get-r picture
This command downloads the picture directory to local.
Get Sam.png
This command downloads the sam.png picture to the local.
Where is the local??
We can use the LPWD command to view the local current working directory-that is, add an L to the PWD command to represent the locality. As you can see, we can also use the LCD to switch the local working directory.
Uploading files
The upload command provided by SFTP is put.
Put Sam.png
This command uploads the sam.png under the local current working directory to the working directory of the remote server.
Put-r picture
Upload the entire directory file.
More commands
All commands provided by SFTP can be viewed at SFTP > Terminal input Help:

Sftp> Help
Available commands:
Bye Quit sftp
CD path change remote directory to ' path '
CHGRP GRP Path Change group of file ' path ' to ' GRP '
chmod mode Path Change permissions of the file ' path ' to ' mode '
Chown own path change owner of file ' path ' to ' own '
DF [-hi] [path] Display statistics for current directory or
FileSystem containing ' path '
Exit Quit SFTP
Get [-PPR] remote [local] Download file
Help Display this help text
LCD path change local directory to ' path '
LLS [ls-options [path]] Display local directory listing
Lmkdir Path Create Local Directory
ln [-S] oldpath newpath Link remote file (-s for symlink)
LPWD Print Local working directory
LS [ -1afhlnrst] [path] Display remote directory listing
Lumask umask Set local umask to ' umask '
mkdir Path Create remote directory
Progress Toggle display of progress meter
Put [-PPR] local [remote] Upload file
PWD Display Remote working directory
Quit Quit SFTP
Rename oldpath newpath rename remote file
RM Path Delete Remote File
RmDir Path Remove remote directory
Symlink oldpath newpath symlink remote file
Version Show SFTP version
!command Execute ' command ' in the local shell
! Escape to the local shell
? Synonym for help

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.