SCP: Transferring files in Linux
How to send a file with scp in Linux
Suppose you need to send the file
big_file
to a remote host with the IP
192.168.0.2
and put it in your home directory.
On the remote host you have the user
andrei and you know their password
scp big_file andrei@192.168.0.2:/home/andrei
How to download a directory with scp in Linux
To send not a single file but a directory with all its nested files use the -r option
scp -r directory andrei@192.168.0.2:/home/andrei
How to download a file with 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 the current directory on your machine.
On the remote host you have the user
andrei and you know their password
scp andrei@192.168.56.2:/home/andrei/Downloads/p_script.py ./
Note the ./ at the end - it tells which directory on your host the file should be saved to.
Article author: Andrei Olegovich