≡ Menu

Unix / Linux: sftp File From One Server To Another

get data.tar.gz

Sample outputs:

Fetching /home/vivek/data.tar.gz to data.tar.gz
/home/vivek/data.tar.gz                                    100% 1960     1.9KB/s   00:01

How do I put (upload) file?

The syntax is as follows to upload a file called file from local machine to the ftp server:

put file

In this example, upload a file called Screenshot.png, enter:

sftp> put Screenshot.png

Sample outputs:

Uploading Screenshot.png to /home/vivek/Screenshot.png
Screenshot.png                                                    100%   12KB  12.2KB/s   00:00

How do I sftp from one server A to another Unix based server B?

First login to server A using the ssh command:
$ ssh user@serverA
Next, sftp to serverB:
$ sftp user@serverB
Finally, upload or download file to serverB:

sftp> put foo
sftp> ls
sftp> get bar
sftp> lls
sftp> exit
Share this tutorial on:
{ 8 comments… add one }
  • pranav April 19, 2013, 12:15 pm

    how to copy file one mac to another in exam

  • Brandi June 10, 2013, 9:25 pm

    How can I copy a whole directory or folder over the servers?

  • TusharK December 19, 2013, 6:20 am

    How can one put files from Server A on AIX platform to server B on RHEL using a shell script

  • TusharK December 19, 2013, 6:37 am

    hello NIX,

    following is done in the shell script

    sftp user_name@server_name

    But it is not accepting the password and shell is stopped and ask for Password.
    could you please suggest how can this be done


  • tanya February 6, 2014, 6:25 am

    ok then how to stop sftp mode? :D

  • Jesse Parker February 7, 2014, 6:42 pm

    Try this
    sftp user_name:password@server_name

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">