SFTP: Transferring files in Linux
Introduction
The directory from which you start sftp is called the working directory.
Connecting to a host over SFTP
To connect to the host run
sftp andrei@10.15.253.206
Connected to 10.15.253.206. sftp>
To disconnect run
exit
How to upload a file
To upload a file from the working directory to the remote host run the put
sftp andrei@10.15.253.206
Connected to 10.15.253.206.
sftp> put testsftp.txt
Uploading testsftp.txt to /home/andrei/testsftp.txt testsftp.txt 100% 1024KB 37.1MB/s 00:00 sftp>
How to download a file over scp in Linux
Suppose you need to download the file
p_script.py
from the Downloads folder
from the remote host
(192.168.0.2)
and put it into your current directory.
On the remote host you have the user
andrei and you know its password
scp andrei@192.168.56.2:/home/andrei/Downloads/p_script.py ./
Note the ./ at the end - this is how you specify which directory on your host the file should be saved to.
Article author: Andrei Olegovich