Using scp and rync to move files

FTP is usually the best choice for transferring files to a remote computer but sometimes for a single file, scp is an alternative. Use this command.
scp xertetoolkits_3.8.zip jimmy@redmouse.xyz:/home/jimmy/transfer
Once it is in place we can unzip it:
unzip xertetoolkits_3.8.zip
It will create a directory structure but the tree will be under ~/transfer. We need to move it while preserving the file structure. The easiest way is to use rsync with the r ( recursive function)
First:
sudo mkdir /var/www/html/xerte
rsync -r ~/transfer/ /var/www/html/xerte

The command copies all the files to the new directory.
Becoming familiar with these commands is very useful when working in Linux. Don’t worry about remembering the syntax – I often google and copy. What is important is knowing which command to use.

Using ssh to log in to your remote server

ssh is a quick way to log on and access the file system of your server. From the bash shell on WSL, I would use this command.


$ ssh jimmy@redmouse.xyz

The remote server will prompt you for the password. You can skip the password step by installing key-based SSH. ( Note:you will still be able to log on using a password on devices without a key pair).


jimmy@WSLBASH:~$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/jimmy/.ssh/id_rsa):

Enter – accept as default


Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Enter – leave the passphrase as blank


Your identification has been saved in /home/jimmy/.ssh/id_rsa.
Your public key has been saved in /home/jimmy/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:j....lgOkE jimmy@WSLBASH
The key's randomart image is:
+---[RSA 2048]----+
| .=++..+ oE |
...................
| + =|
| = |
+----[SHA256]-----+
jimmy@WSLBASH:~$

Your output should look something like this.
Now you have a private and public key saved in ~/.ssh/
Copy the public key to your server.


ssh-copy-id -i ~/.ssh/id_rsa.pub yourserver.com

Now you should be able to log in using ssh without having to enter a password. No password means you can start using other useful bash commands such as scp and rsync.