@@ -8,24 +8,23 @@ objectives:
8
8
- " Be able to transfer files to and from a computing cluster."
9
9
keypoints :
10
10
- " `wget` and `curl -O` download a file from the internet."
11
- - " `scp` transfer files to and from your computer."
11
+ - " `scp` and `rsync` transfer files to and from your computer."
12
12
- " You can use an SFTP client like FileZilla to transfer files through a GUI."
13
13
---
14
14
15
- Computing with a remote computer offers very limited utility if we cannot
16
- get files to or from the cluster. There are several options for
17
- transferring data between computing resources, from command line
18
- options to GUI programs, which we will cover here.
15
+ Performing work on a remote computer is not very useful if we cannot get files
16
+ to or from the cluster. There are several options for transferring data between
17
+ computing resources using CLI and GUI utilities, a few of which we will cover.
19
18
20
19
## Download Files From the Internet
21
20
22
21
One of the most straightforward ways to download files is to use either ` curl `
23
22
or ` wget ` . One of these is usually installed in most Linux shells, on Mac OS
24
- terminal and in GitBash. Any file that can be downloaded in your web browser
25
- through a direct link can be downloaded using ` curl -O ` or ` wget ` . This is a
26
- quick way to download datasets or source code.
23
+ terminal and in GitBash. Any file that can be downloaded in your web browser
24
+ through a direct link can be downloaded using ` curl -O ` or ` wget ` . This is a
25
+ quick way to download datasets or source code.
27
26
28
- The syntax for these commands is: ` curl -O https://some/link/to/a/file `
27
+ The syntax for these commands is: ` curl -O https://some/link/to/a/file `
29
28
and ` wget https://some/link/to/a/file ` . Try it out by downloading
30
29
some material we'll use later on, from a terminal on your local machine.
31
30
53
52
54
53
To copy a single file to or from the cluster, we can use ` scp ` ("secure copy").
55
54
The syntax can be a little complex for new users, but we'll break it down.
56
- The ` scp ` command is a relative of the ` ssh ` command we used to
55
+ The ` scp ` command is a relative of the ` ssh ` command we used to
57
56
access the system, and can use the same public-key authentication
58
57
mechanism.
59
58
@@ -203,6 +202,34 @@ A trailing slash on the target directory is optional, and has no effect for
203
202
> {: .language-bash}
204
203
{: .callout}
205
204
205
+ All file transfers using the above methods use SSH to encrypt data sent through
206
+ the network. So, if you can connect via SSH, you will be able to transfer
207
+ files. By default, SSH uses network port 22. If a custom SSH port is in use,
208
+ you will have to specify it using the appropriate flag, often `-p`, `-P`, or
209
+ `--port`. Check `--help` or the `man` page if you're unsure.
210
+
211
+ > ## Change the Rsync Port
212
+ >
213
+ > Say we have to connect `rsync` through port 768 instead of 22. How would we
214
+ > modify this command?
215
+ >
216
+ > ```
217
+ > {{ site.local.prompt }} rsync test.txt {{ site.remote.user }}@{{ site.remote.login }}:
218
+ > ```
219
+ > {: .language-bash}
220
+ >
221
+ > > ## Solution
222
+ > >
223
+ > > ```
224
+ > > {{ site.local.prompt }} rsync --help | grep port
225
+ > > --port=PORT specify double-colon alternate port number
226
+ > > See http://rsync.samba.org/ for updates, bug reports, and answers
227
+ > > {{ site.local.prompt }} rsync --port=768 test.txt {{ site.remote.user }}@{{ site.remote.login }}:
228
+ > > ```
229
+ > > {: .language-bash}
230
+ > {: .solution}
231
+ > {: .challenge}
232
+
206
233
## Transferring Files Interactively with FileZilla
207
234
208
235
FileZilla is a cross-platform client for downloading and uploading files to and
0 commit comments