Posted: . At: 11:06 AM. This was 8 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.


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


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.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.