Skip to content
Go back

Useful SFTP terminal commands

First Step - Connect to a remote computer

sftp -i ~/.ssh/LightsailDefaultKey-ap-south-1.pem [email protected]

Similar to ssh command.

Output:

Connected to 52.66.180.155.

sftp>

Remote and Local computer commands

When we relay basic terminal commands at sftp> like 'pwd, ls, cd, and it is executed at the remote computer.

Basic terminal commands above when prefixed with l like lpwd, lls, lcd and etc. it is executed at a local computer.

For e.g.

List all files in the present working directory at the remote computer:

sftp> ls

List all files in the present working directory at the local computer:

sftp> lls

Sending a local computer file to present the working directory of a remote computer

sftp> put /Users/mj/Downloads/test.png

Output

Uploading /Users/mj/Downloads/test.png to /home/ubuntu/test.png

/Users/mj/Downloads/tech-mrit-prod.ovpn 100% 13KB 382.9KB/s 00:00

References

  1. How To Use SFTP to Securely Transfer Files with a Remote Server

Share this post on:

Previous Post
Working with Twilio
Next Post
FastAPI first shot