Skip to content

Commit 4188311

Browse files
2 parents d95410d + c11861a commit 4188311

File tree

4 files changed

+136
-104
lines changed

4 files changed

+136
-104
lines changed

docs/sessions/scp/README.md

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ tags:
2828

2929
## Overview other terminal transfer tools
3030

31+
<!-- markdownlint-disable MD013 --><!-- Let's break 80 characters per line -->
32+
33+
3134
- `scp` has the similar arguments as for the linux copy function `cp`.
3235
- `sftp` is more versatile with more file management capabilities.
3336
- `rsync` is perfect for syncing and have many capabilities
3437

3538
- All are considered secure.
3639

37-
<!-- markdownlint-disable MD013 --><!-- Tables cannot be split up over lines, hence will break 80 characters per line -->
38-
3940
???- question "But what is ``wget`` and ``curl``?"
4041

4142
- These tools are used to download files from websites or ftp servers
@@ -58,7 +59,6 @@ tags:
5859
- interacting with APIs, handling complex web requests
5960
- often available by default on Windows and MacOS.
6061

61-
<!-- markdownlint-enable MD013 -->
6262

6363
**SCP is an abbreviation for ``Secure Copy Protocol``**
6464

@@ -73,83 +73,74 @@ tags:
7373

7474
!!! warning "When not to use"
7575

76-
- When needing several one-line commands
76+
- When needing **several one-line** commands
7777
- requires credentials every time
78-
- When looking to do more than a basic file transfer, SCP falls short.
79-
- When you on the fly need to create or list directories or delete files.
80-
- A file with the same name in the same directory is transferred, will be overwritten.
81-
- Transfers that are interrupted you have to restart the entire transfer.
78+
- When looking to do **more than a basic** file transfer, SCP falls short.
79+
- Transfers that are **interrupted** you have to restart the entire transfer.
80+
- A file with the **same name** in the same directory is transferred, will be overwritten.
81+
82+
!!! warning "Risk of overwriting files"
83+
84+
- There is no warning if a file is about to be overwritten.
85+
- There is no ``scp -i ...`` as for ``rm -i`` that asks if you really want to remove the file.
86+
- 'rsync' may be a better tool if you want to sync existing content.
8287

8388
## Procedure
8489

85-
<!-- markdownlint-disable MD013 --><!-- Let's break 80 characters per line -->
90+
- Run the scp commands on YOUR computer, since you probably do not have a server address to your computer!
91+
- In the terminal (from **local**, not server session)
8692

93+
```bash
94+
scp <from> <to>
95+
```
96+
97+
- Where `<from>` is the file(s) you want to copy, and `<to>` is the destination.
8798

88-
!!! tip
99+
???- tip "Syntax for command arguments"
89100

90101
- We use `<content>` to tell that this should be replaced by applicable names or paths etcetera...
91102
- We use ``[content]`` to tell that this argument is not necessary
92103

93-
- In the terminal
94-
95-
```bash
96-
scp <from> <to>
97-
```
98-
99-
Where `<from>` is the file(s) you want to copy, and `<to>` is the destination.
104+
??? info "More detailed general procedure"
100105

101-
Copy a file **from your local computer** to the cluster:
106+
Copy a file **from your local computer** to the cluster:
102107

103-
```bash
104-
scp <local_filename> <username>@<cluster adress>:<path-to-folder/>
105-
```
108+
```bash
109+
scp <local_file/folder> <username>@<cluster adress>:<path-to-folder/>
110+
```
106111

107-
Copy a file **from the cluster** to your local computer, do the command above in reverse order:
112+
- where `<username>` is your cluster username,
113+
- where `<local_folder>` is your local folder, for example:
108114

109-
```bash
110-
scp <username>@<cluster adress>:<path-to-folder>/<remote_filename> <local_folder or "." for _present_ folder>
111-
```
112115

113-
???- example "Example for Tetralith"
114-
115-
This is how you copy a file from your local computer directly to your HOME folder (~/):
116+
Copy a file **from the cluster** to your local computer, do the command above in reverse order:
116117

117118
```bash
118-
scp <local_filename> <username>@tetralith.nsc.liu.se:~/
119+
scp <username>@<cluster adress>:<path-to-folder/file> <local_folder or "." for _present_ folder>
119120
```
120121

121-
where `<local_filename>` is the path to a local filename,
122-
and `<username>` is your Tetralith username, for example:
122+
If asked, give your center's password.
123+
You can get rid of this prompt if you have setup SSH keys
123124
124-
```bash
125-
scp my_file.txt [email protected]:/home/sven
126-
```
127125
128-
To copy a file from Tetralith to your local computer,
129-
do the command above in reverse order:
126+
???- example "Example for Tetralith"
127+
128+
This is how you copy a file from your local computer directly to your HOME folder (~/):
130129
131130
```bash
132-
scp <username>@tetralith.nsc.liu.se:/home/<username>/<remote_filename> <local_folder>
131+
scp my_file.txt x_nisse@tetralith.nsc.liu.se:~/
133132
```
134133
135-
where `<remote_filename>` is the path to a remote filename,
136-
`<username>` is your UPPMAX username,
137-
and `<local_folder>` is your local folder, for example:
134+
To copy a file from Tetralith to your local computer (and present folder),
135+
do the command above in reverse order:
138136
139137
```bash
140-
scp [email protected].se:/home/sven/my_remote_file.txt /home/sven
138+
scp [email protected].se:/home/x_nisse/remote_file.txt .
141139
```
142140
143141
If asked, give your center's password.
144142
You can get rid of this prompt if you have setup SSH keys
145143

146-
147-
!!! warning
148-
149-
- There is no warning if a file is about to be overwritten.
150-
- There is no ``scp -i ...`` as for ``rm -i`` that asks if you really want to remove the file.
151-
- 'rsync' may be a better tool if you want to sync existing content.
152-
153144
???- tip "Cheat sheet for ``scp``"
154145

155146
- ``scp`` followed by none or any of the following option flags and the files and servers involved
@@ -164,12 +155,12 @@ scp <username>@<cluster adress>:<path-to-folder>/<remote_filename> <local_folder
164155

165156
## Exercises
166157

167-
!!! warning "You may want to prioritize next session instead!"
168-
169158
???- question "Exercise 0: Use the documentation of your HPC cluster"
170159

171160
- Search for how to transfer files to/from your HPC cluster using `scp`. At which URL is it described?
172161
- Tip: not all HPC centers have documented this, so you *should* give up searching after a while.
162+
163+
- If the center maintaining you HPC cluster has not documented how to use `scp`, follow [the Rackham documentation](https://docs.uppmax.uu.se/software/rackham_file_transfer_using_scp).
173164

174165
???- question "Where is that documentation?"
175166

@@ -190,25 +181,35 @@ scp <username>@<cluster adress>:<path-to-folder>/<remote_filename> <local_folder
190181

191182
Tips
192183

184+
- Useful terminal commands (both locally and remotely)
185+
- ``pwd`` - which folder am I in?
186+
- ``cd [path]`` - change folder (go up in hierarchy with ``cd ..``)
187+
- ``ls`` - list content of folder
188+
- ``mkdir`` - make a new folder
189+
- ``touch`` - create empty file
190+
193191
- (If you want to create a file in local terminal: ``$ touch local_file``)
194192
- (You can check the file structure in an ssh session)
195193
- Send it to an existing folder (e.g. ``transfer``) on Tetralith
194+
- use ``mkdir <folder name>`` if it is not there
196195
- Check on server that it is there
197196

198197
???- tip "Answer (Tetralith example)"
199198

200199
Locally
201200

202201
- (If you want to create a file in *local* terminal: ``$ touch local_file``)
203-
- Send it to an existing folder (e.g. ``transfer``) on Tetralith: ``$ scp local_file <username>@tetralith.nsc.liu.se:~/transfer/``
202+
- Send it to an existing folder (e.g. ``transfer``) on Tetralith:
203+
204+
- ``$ scp local_file <username>@tetralith.nsc.liu.se:~/transfer/``
204205

205206
Check on server that it is there
206207

207208
- ``$ ls ~/transfer``
208209

209210
- [Video for Tetralith>(https://youtu.be/rvL-s5vi13I)
210211

211-
???- question "Exercise 2: Download a file from your the server to you computer, using scp"
212+
???- question "Exercise 2: Download a file from the server to your computer, using scp"
212213

213214
Tips
214215

@@ -221,7 +222,7 @@ scp <username>@<cluster adress>:<path-to-folder>/<remote_filename> <local_folder
221222
On Server
222223

223224
- (If you want to create a remote file first, in an SSH session, do: ``$ touch remote_file``)
224-
- Get it to an existing local folder (e.g. ``transfer``): ``$ scp <username>@tetralith.nsc.liu.se:~/transfer/remote_file .``
225+
- Get it the present local folder: ``$ scp <username>@tetralith.nsc.liu.se:~/transfer/remote_file .``
225226

226227
Check locally that it is there
227228

docs/sessions/sftp/README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,45 +51,49 @@ tags:
5151

5252
- Rsync is better for "syncing"
5353

54-
5554
## Procedure
5655

57-
In the terminal, run `sftp` to connect to Rackham by doing:
56+
<!-- markdownlint-disable MD013 --><!-- Let's break 80 characters per line -->
57+
58+
- Run the sftp commands on YOUR computer, since you probably do not have a server address to your computer!
59+
- In the terminal (from **local**, not server session)
5860

5961
```bash
60-
sftp [username]@<cluster address>
62+
sftp <username>@<cluster address>
6163
```
6264

63-
In `sftp` session, upload/download files to/from the server.
65+
In `sftp` session, go to right folders and upload/download files to/from the server. You can do this as long as the connection is active!
6466

65-
- ``put <filename>`` - Copy a file from the local computer to the remote host
66-
- ``get <filename>`` - Copy a file from the remote host to the local computer
67+
- ``pwd/cd/ls`` - **browse** and list files in **server file system**
68+
- ``lpwd/lcd/lls`` - **browse** and list files in **local file system**
69+
- ``put <file/folder>`` - **Copy** a file/folder **from the local** computer to the remote host
70+
- ``get <file/folder>`` - **Copy** a file/folder **from the remote** host to the local computer
6771

68-
???- example "Example for Rackham"
72+
???- tip "Syntax for command arguments"
6973

70-
Connect to SFTP session
74+
- We use `<content>` to tell that this should be replaced by applicable names or paths etcetera...
75+
- We use ``[content]`` to tell that this argument is not necessary
76+
- Run the sftp commands on YOUR computer, since you probably do not have a server address to your computer!
7177

72-
In the terminal, run `sftp` to connect to Rackham by doing:
78+
???- example "Example for Tetralith"
7379

74-
```bash
75-
sftp [username]@rackham.uppmax.uu.se
76-
```
80+
Connect to SFTP session
7781

78-
where `[username]` is your UPPMAX username, for example:
82+
In the terminal, run `sftp` to connect to Tetralith by doing:
7983

8084
```bash
81-
85+
8286
```
8387

8488
If asked, give your center's password.
8589
You can get rid of this prompt if you have setup SSH keys
8690

87-
Upload/download files to/from Rackham
91+
Upload/download files to/from Tetralith
8892

89-
In `sftp` session, upload/download files to/from the server.
93+
In `sftp` session, upload/download files/folders to/from the server.
9094

91-
- ``put <filename>`` - Copy a file from the local computer to the remote host
92-
- ``get <filename>`` - Copy a file from the remote host to the local computer
95+
- ``put localfile.txt`` - Copy a file from the local computer to the remote host
96+
- ``get serverfile.txt`` - Copy a file from the remote host to the local computer
9397

9498
???- tip "Cheat sheet in the SFTP session"
9599

@@ -117,12 +121,11 @@ In `sftp` session, upload/download files to/from the server.
117121

118122
## Exercises
119123

120-
<!-- markdownlint-disable MD013 --><!-- Tables cannot be split up over lines, hence will break 80 characters per line -->
121-
122-
??? question "Use the documentation of your HPC cluster"
124+
??? question "Exercise 0: Use the documentation of your HPC cluster"
123125

124126
- Search for how to transfer files to/from your HPC cluster using `scp`. Which URL is it described?
125-
- Tip: not all HPC centers have documented this, so you *should* give up searching after a while.
127+
- Tip: not all HPC centers have documented this, so you *should* give up searching after a while.
128+
- If the center maintaining you HPC cluster has not documented how to use `sftp`, follow [the Rackham documentation](https://docs.uppmax.uu.se/software/rackham_file_transfer_using_sftp).
126129

127130
<!-- markdownlint-disable MD013 --><!-- Tables cannot be split up over lines, hence will break 80 characters per line -->
128131

@@ -141,10 +144,10 @@ In `sftp` session, upload/download files to/from the server.
141144
Tetralith |[here](https://www.nsc.liu.se/support/copying-data/)
142145
Vera |**FIX?** None.
143146

144-
???- question "Dardel documentation uses ``psftp``, what is that?"
147+
???- question "Dardel documentation uses ``psftp``, what is that?"
145148

146-
- It is just a SFTP component of the client PuTTY.
147-
- Same commands as for SFTP.
149+
- It is just a SFTP component of the client PuTTY.
150+
- Same commands as for SFTP.
148151

149152
???- question "Exercise 1: Establish the sftp connection and find the relevant folders locally and remotely"
150153

docs/sessions/summary.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ FileZilla |Graphical, intuitive, simple |SFTP, `
1717
`rsync` |Terminal, powerful, flexible, feels like a regular file copy|`rsync my_file.txt my_username@my_cluster.se:/home/my_username/` and `rsync --recursive my_folder my_username@my_cluster.se:/home/my_username/`
1818
`sftp` |Terminal, simple, feels like a file transfer portal |`sftp` and `put` and `get`
1919

20-
<!-- markdownlint-enable MD013 -->
20+
21+
!!! tips
22+
23+
- Archive folders with many files! - Less overhead and many files on the fly are included in the transfer!
24+
- Compress files and folders! - Less size will be faster to transfer!

0 commit comments

Comments
 (0)