Md Toy Blog

Sending files to a remote ubuntu


We are going to use sftp.

Connect to the remote using sftp:

sftp -i .ssh/id_rsa <remote_user>@<remote_host_ip_or_domain>

# for example
sftp -i .ssh/id_rsa


This will start an sftp session. Basically you have the local commands and the remote commands to change directories in order to select the source directory and the destination directory.

To copy a file you have locally named ~/hey/ to the remote directory /home/ubutu/Documents/, do the following:

> cd /home/ubuntu/Documents
# send to remote
> put ~/hey/
> bye


to copy from the remote into the local do:

> lcd ~/hey/ALocalDir
# get from remote and save to ~/hey/ALocalDir/
> get /home/ubuntu/Documents/
> bye