Secure File Transfer Protocol (SFTP) commands


It’s secure file transfer protocol or SSH file transfer protocol. We can also use FTP and SCP to transfer files to remote server. But SFTP is the most secure and interactive way to transfer files to a remote server. It uses the same authentication method that are available for SSH. You can use username with  password or username with SSH keys to authenticate with remote server. There are several GUI tools are available for SFTP. In this article I will let you know how to use SFTP in command line.

Difference between FTP , SCP and SFTP:

FTP is know as File Transfer Protocol and it’s don’t have any security feature. FTP is interactive but due to lack of security it’s not advisable to use. The default port is 21 for FTP

SCP is know as Secure Copy Protocol. It is secure but not interactive. It uses the same authentication as the SSH. You can only transfer files with this protocol. Because of it is not interactive you can’t issue any commands in the remote machine. The default port is 22 for SCP

SFTP is know as SSH File Transfer Protocol. It’s interactive and you can create file, delete file, change directory using this command in the remote server. The default por i

How to Connect:

Useful Commands for SFTP:

How to use SFTP in shell or bash script:

Using the blow script we can upload a file from our local machine to a defined folder of the remote machine. If you want to upload multiple file then you can use mput command instead of put .


The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

Leave a Reply