So related to SSH, there is rsync.
rsync is a remote sync.
And it is using secure shell to synchronize files remotely
between servers.
The benefit of rsync is that if source and target
files already exist, rsync will only
synchronize their differences.
So this is a perfect solution if you
have directory contents that need to be synchronized,
for instance.
rsync can be used with many options, of which
the following are most common.
Minus r will recursively synchronize
the entire directory tree.
Minus l will synchronize symbolic links.
Minus p preserves them.
And minus n will do a dry run before actually synchronizing
so that you can see what is happening.
One of the most commonly used options
is minus a, that is the archive mode.
And that means that you are going to keep
all properties of your files.
If access control lists are used,
use minus uppercase A and use minus uppercase X
to synchronize SC Linux context as well.
Let me show you how this works.
So I need to prepare this a little bit.
And in order to do so, I'm using SSH student
at 192.168.29.143.
Where in user student home directory,
I'm creating a directory files.
And in there, I'm going to use for i in 1.9.
Do echo hello greater than files slash file dollar i
semicolon done.
Do you recognize this is a simple shell script
written as a one liner.
So it's iterating over the range one up to nine.
And the result should be that we have a bunch of files
in the files directory, as you can see.
Now, let me check one of these files.
It's a random one.
And as you can see, it works.
We do want to have files with some content, right?
Next, I'm going back to my local server.
And there, I'm making the directory files.
Now, we already have the directory file.
So that's even better.
And what do we have in here?
Now, I need to get back to a shell as user student.
And we don't have a files directory.
So let me create a directory files.
So next, let me use echo hello greater than files file 1.
And echo goodbye greater than files file 2.
So now, I'm going to synchronize using rsync minus a student
at 192.168.29.143 colon slash home slash student
slash files slash star.
And I'm synchronizing that to dot slash files.
And what is the result?
Well, the result is that now in files,
we have all files from the remote server as well.
And that's how you can use rsync.