Copy a file from one UNIX/Linux machine to another using the sftp utility.

Posted: May 10, 2016. At: 11:06 AM. This was 2 years ago. Post ID: 9085
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

Copying a file with sftp from one UNIX machine to another is very easy. The command below uses the SSH protocol and initiates a connection to the remote PC.

ubuntu ~ $ sftp -P 443 jason@192.168.1.5

Press ENTER and type your password. The user will be presented with a sftp> prompt.

ubuntu ~ $ sftp -P 443 jason@192.168.1.5
Ubuntu 16.04 LTS
jason@192.168.1.5's password:
Connected to 192.168.1.5.
sftp>

Then type this command to retrieve the remote file to your local machine.

sftp> get root.jpeg
Fetching /home/jason/root.jpeg to root.jpeg
/home/jason/root.jpeg                                                                                              100%  400KB  36.3KB/s   00:11
sftp>

Now the file is on my local machine…

ubuntu ~ $ ls -hula root.jpeg
-rw-rw-r-- 1 ubuntu ubuntu 400K May 10 00:52 root.jpeg

That is how easy it is to get files from a remote UNIX/Linux machine. Type ? at the sftp prompt to get help on commands.

No comments have been made. Use this form to start the conversation :)

Leave a Reply