SFTP Comand
sFTP Commands-File Transfer Protocol (FTP) is a widely used protocol to transmit files or data in an untrusted manner in a non-secure way. As we all know, File Transfer Protocol is not secure in any way, because all transmissions occur in plain text and the data can be read by anyone when scanning packets on the network. Therefore, FTP can be used in limited situations or on networks you trust. Over time, SCP and SSH address this security uncertainty and add an encrypted secure layer when transferring data between remote computers.

SFTP (Secure File Transfer Protocol) runs via the SSH protocol on standard port 22 by default to establish a secure connection. SFTP is integrated into several GUI tools (FileZilla, WinSCP, FireFTP, etc.).

This article will direct an example of a 10 sftp command to use with the interactive command line interface.

1. How to Connect to SFTP

By default, the same SSH protocol is used to verify and establish an SFTP connection. To start an SFTP session, enter the user name and the remote hostname or IP address at the command prompt. After the authentication is successful, you will see a shell with the sftp> prompt.

[root@tecmint ~]# sftp tecmint@27.48.137.6

Connecting to 27.48.137.6...
tecmint@27.48.137.6's password:
sftp>

2. Getting Help

Once, at the sftp prompt, check the available commands by typing in? ‘Or in help‘ at the command prompt.

sftp> ?
Available commands:
cd path                       Change remote directory to 'path'
lcd path                      Change local directory to 'path'
help                          Display this help text
get remote-path [local-path]  Download file
lls [ls-options [path]]       Display local directory listing
ln oldpath newpath            Symlink remote file
lmkdir path                   Create local directory
lpwd                          Print local working directory
ls [path]                     Display remote directory listing
lumask umask                  Set local umask to 'umask'
mkdir path                    Create remote directory
put local-path [remote-path]  Upload file
pwd                           Display remote working directory
exit                          Quit sftp
quit                          Quit sftp
rename oldpath newpath        Rename remote file
rmdir path                    Remove remote directory
rm path                       Delete remote file
symlink oldpath newpath       Symlink remote file
version                       Show SFTP version
!command                      Execute 'command' in local shell
!                             Escape to local shell
?                             Synonym for help

3. Check Current Work Guide

Present lpwdini command Used to control the local current working directory, için pwd çalışma command Used to control the remote working directory.

sftp> lpwd
Local working directory: /
sftp> pwd
Remote working directory: /tecmint/
  • lpwd - To print the current directory on your system FTP
  • pwd - To Print the current directory on the file tranfers Protocol <FTP> server

4. List Files

To be able to list the files locally as well as the remote system.
On Remote
sftp> ls
 
On Local
 
sftp> lls

5. Upload File

Put single or multiple files into the remote system.
sftp> put local.profile
Uploading local.profile to /tecmint/local.profile

6. Upload Multiple Files


Put multiple files on the remote system.

sftp> mput *.xls

6. Download Files

Single or multiple files are being retrieved in the local system.

sftp> get SettlementReport_1-10th.xls
Fetching /tecmint/SettlementReport_1-10th.xls to SettlementReport_1-10th.xls

Get multiple files on a local system.

sftp> mget *.xls

7. Directory Replacement

Switch from a directory in local and remote locations to another directory.
On Remote

sftp> cd test
sftp>
 
On Local

sftp> lcd Documents

8. Create Directories

Create new directories in local and remote locations.

sftp> mkdir test
sftp> lmkdir Documents

9. Remove Directories

Remove the directory or file on the remote system.

sftp> rm Report.xls
sftp> rmdir sub1

10. Exit the sFTP Shell

Command ‘!‘ Drops us to the local shell from where we can run the Linux command. Type ‘exit‘ command where we can see sftp> prompt again

sftp> !

[root@sftp ~]# exit
Shell exited with status 1
sftp>

Result
SFTP is a very useful tool for managing servers and transferring files (local and remote) or local. We hope this information will help you to understand the extent of the use of SFTP.

Incoming Search Terms :

Discussion: