From 3fae27b5667ee3645facbe80cd31c97dad1d516c Mon Sep 17 00:00:00 2001 From: Rasmus Kronberg Date: Wed, 31 Jul 2024 14:58:28 +0300 Subject: [PATCH 1/2] Separate prerequisites --- index.md | 34 +++++++++++-------- part-1/index.md | 6 ++-- part-2/index.md | 2 +- .../cli}/basic-file-editing.md | 6 ++-- .../cli}/basic-linux-commands.md | 6 ++-- prereq/cli/index.md | 15 ++++++++ .../cli}/my-first-file.txt | 5 +-- .../getting-access}/credentials.md | 4 +-- .../getting-access}/index.md | 14 ++++---- .../getting-access}/ssh-keys.md | 6 ++-- .../getting-access}/ssh-puhti.md | 4 +-- prereq/index.md | 13 +++++++ 12 files changed, 74 insertions(+), 41 deletions(-) rename {part-1/prerequisites => prereq/cli}/basic-file-editing.md (98%) rename {part-1/prerequisites => prereq/cli}/basic-linux-commands.md (97%) create mode 100644 prereq/cli/index.md rename {part-1/prerequisites => prereq/cli}/my-first-file.txt (63%) rename {part-1/prerequisites => prereq/getting-access}/credentials.md (97%) rename {part-1/prerequisites => prereq/getting-access}/index.md (54%) rename {part-1/prerequisites => prereq/getting-access}/ssh-keys.md (98%) rename {part-1/prerequisites => prereq/getting-access}/ssh-puhti.md (99%) create mode 100644 prereq/index.md diff --git a/index.md b/index.md index 82edfa61..e0d62bce 100644 --- a/index.md +++ b/index.md @@ -7,22 +7,28 @@ nav_order: 1 # CSC Computing Environment {: .fs-9 } -Welcome! This website contains materials for the *CSC Computing Environment* -course. +Welcome! This website contains materials for the *CSC Computing Environment* +-course. {: .fs-6 .fw-300 } +[Part 1 -- Get started with the basics!](part-1){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } +[Part 2 -- Dig deeper into HPC workflows!](part-2){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } + ## Guidelines -1. The course is divided into two parts and the material is organized by topics of increasing complexity -- Feel free to jump to Part 2 if you know the basics already! -2. In each topic, first read the slides / watch the video. -3. Complete the tutorial(s) to make sure you’ve got the steps right. -4. Try out the exercises to verify your new skills. -5. If you get stuck, consult [Docs CSC](https://docs.csc.fi) linked in the slides and the tutorials. -6. If the documentation does not provide a sufficient answer, please contact support by emailing or by filling in the contact form at . - * You may also [join our weekly user support coffees](https://ssl.eventilla.com/usersupportcoffee/EN) if you'd like to discuss your issue in person with our specialists! -7. Press and hold ctrl/cmd and click to open links in a new window or tab. -8. Left-click the slides to enable navigation with the arrow keys (or use the arrow icons in the bottom-right corner on each slide). -9. Click the home icon in the bottom-right corner on any slide to return to this page. -10. [A video with study tips](https://video.csc.fi/media/t/0_d7trmsru). +1. The course is divided into two parts and the material is organized by topics of increasing complexity -- feel free to jump to Part 2 if you know the basics already! +2. If you're completely new to CSC and working on a command-line, start by going through the Prerequisites. +3. In each topic, first read the slides / watch the video. +4. Complete the tutorial(s) to make sure you’ve got the steps right. +5. Try out the exercises to verify your new skills. +6. If you get stuck, consult [Docs CSC](https://docs.csc.fi) linked in the slides and the tutorials. +7. If the documentation does not provide a sufficient answer, please contact support by emailing or by filling in the contact form at . + * You may also [join our weekly user support coffees](https://ssl.eventilla.com/usersupportcoffee/EN) to discuss your issue in person with our specialists! +8. Navigate the slides by using the arrow keys or click the arrow icons in the bottom-right corner of each slide. +9. Press and hold ctrl/cmd and click to open links in a new window or tab. +10. Click the home icon in the bottom-right corner of any slide to return to this page. +11. [A video with study tips](https://video.csc.fi/media/t/0_d7trmsru). -[Part 1 -- Get started with the basics!](part-1){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } -[Part 2 -- Dig deeper into HPC workflows!](part-2){: .btn .btn-primary .fs-5 .mb-4 .mb-md-0 .mr-2 } +{: .highlight} +Don't have a CSC account yet? Never used a Linux command-line interface? +[Get acquainted with the prerequisites!](prereq){: .btn .btn-outline .mt-2 } diff --git a/part-1/index.md b/part-1/index.md index 5a657033..255ecf39 100644 --- a/part-1/index.md +++ b/part-1/index.md @@ -1,13 +1,13 @@ --- layout: default title: Part 1 -nav_order: 2 +nav_order: 3 has_children: true --- # Part 1 -- Basics -Start here to learn the basics of working efficiently in CSC's computing environment! This part -walks you through the prerequisites and introduces essential concepts such as disk areas, the +Start here to learn the basics of working efficiently in CSC's computing +environment! This part introduces essential concepts such as disk areas, the module system, batch jobs and the object storage service Allas. {: .fs-6 .fw-300 } diff --git a/part-2/index.md b/part-2/index.md index 58b7fc43..4762d9be 100644 --- a/part-2/index.md +++ b/part-2/index.md @@ -1,7 +1,7 @@ --- layout: default title: Part 2 -nav_order: 3 +nav_order: 4 has_children: true --- diff --git a/part-1/prerequisites/basic-file-editing.md b/prereq/cli/basic-file-editing.md similarity index 98% rename from part-1/prerequisites/basic-file-editing.md rename to prereq/cli/basic-file-editing.md index fa4342a7..51e2db10 100644 --- a/part-1/prerequisites/basic-file-editing.md +++ b/prereq/cli/basic-file-editing.md @@ -1,9 +1,9 @@ --- layout: default title: Basic file editing -parent: 1. Prerequisites -grand_parent: Part 1 -nav_order: 4 +parent: 2. Command-line basics +grand_parent: Prerequisites +nav_order: 2 permalink: /hands-on/linux_prerequisites/basic-file-editing.html --- diff --git a/part-1/prerequisites/basic-linux-commands.md b/prereq/cli/basic-linux-commands.md similarity index 97% rename from part-1/prerequisites/basic-linux-commands.md rename to prereq/cli/basic-linux-commands.md index a0ca53e6..703f538c 100644 --- a/part-1/prerequisites/basic-linux-commands.md +++ b/prereq/cli/basic-linux-commands.md @@ -1,9 +1,9 @@ --- layout: default title: Basic Linux commands -parent: 1. Prerequisites -grand_parent: Part 1 -nav_order: 3 +parent: 2. Command-line basics +grand_parent: Prerequisites +nav_order: 1 permalink: /hands-on/linux_prerequisites/basic-linux-commands.html --- diff --git a/prereq/cli/index.md b/prereq/cli/index.md new file mode 100644 index 00000000..4e0716ab --- /dev/null +++ b/prereq/cli/index.md @@ -0,0 +1,15 @@ +--- +layout: default +title: 2. Command-line basics +parent: Prerequisites +nav_order: 2 +has_children: true +has_toc: false +--- + +# 2. Command-line basics + +## 2.1 Tutorials and exercises + +1. [Tutorial - Basic Linux commands]({{ site.baseurl }}{% link prereq/cli/basic-linux-commands.md %}) +2. [Tutorial - Basic file editing]({{ site.baseurl }}{% link prereq/cli/basic-file-editing.md %}) diff --git a/part-1/prerequisites/my-first-file.txt b/prereq/cli/my-first-file.txt similarity index 63% rename from part-1/prerequisites/my-first-file.txt rename to prereq/cli/my-first-file.txt index 58c765fa..cc57d103 100644 --- a/part-1/prerequisites/my-first-file.txt +++ b/prereq/cli/my-first-file.txt @@ -1,6 +1,7 @@ -Hi there! Good job! +Hi there! Good job! + This is a test text file. You can play around with this file. You can try typing here with Nano, Emacs, Vim or another text editor! -Write for example how did you manage to open this file :) \ No newline at end of file +Write for example how you managed to open this file :) diff --git a/part-1/prerequisites/credentials.md b/prereq/getting-access/credentials.md similarity index 97% rename from part-1/prerequisites/credentials.md rename to prereq/getting-access/credentials.md index 3e526c95..c5c23360 100644 --- a/part-1/prerequisites/credentials.md +++ b/prereq/getting-access/credentials.md @@ -1,8 +1,8 @@ --- layout: default title: CSC account and project -parent: 1. Prerequisites -grand_parent: Part 1 +parent: 1. Getting access +grand_parent: Prerequisites nav_order: 1 permalink: /hands-on/connecting/credentials.html --- diff --git a/part-1/prerequisites/index.md b/prereq/getting-access/index.md similarity index 54% rename from part-1/prerequisites/index.md rename to prereq/getting-access/index.md index 6ad063d3..a05547cd 100644 --- a/part-1/prerequisites/index.md +++ b/prereq/getting-access/index.md @@ -1,13 +1,13 @@ --- layout: default -title: 1. Prerequisites -parent: Part 1 +title: 1. Getting access +parent: Prerequisites nav_order: 1 has_children: true has_toc: false --- -# 1. Prerequisites (accounts, connecting, command-line basics) +# 1. CSC accounts & projects, connecting ## [1.1 Slides: Accounts and projects](https://a3s.fi/CSC_training/00_account_and_project.html) @@ -21,8 +21,6 @@ has_toc: false ## 1.6 Tutorials and exercises -1. [Essential tutorial - Getting a CSC account and project]({{ site.baseurl }}{% link part-1/prerequisites/credentials.md %}) -2. [Essential tutorial - Login to Puhti via a browser or SSH]({{ site.baseurl }}{% link part-1/prerequisites/ssh-puhti.md %}) -3. [Tutorial - Basic Linux commands]({{ site.baseurl }}{% link part-1/prerequisites/basic-linux-commands.md %}) -4. [Tutorial - Basic file editing]({{ site.baseurl }}{% link part-1/prerequisites/basic-file-editing.md %}) -5. [Advanced tutorial - Using SSH keys to authenticate connection]({{ site.baseurl }}{% link part-1/prerequisites/ssh-keys.md %}) \ No newline at end of file +1. [Essential tutorial - Getting a CSC account and project]({{ site.baseurl }}{% link prereq/getting-access/credentials.md %}) +2. [Essential tutorial - Login to Puhti via a browser or SSH]({{ site.baseurl }}{% link prereq/getting-access/ssh-puhti.md %}) +3. [Advanced tutorial - Using SSH keys to authenticate connection]({{ site.baseurl }}{% link prereq/getting-access/ssh-keys.md %}) \ No newline at end of file diff --git a/part-1/prerequisites/ssh-keys.md b/prereq/getting-access/ssh-keys.md similarity index 98% rename from part-1/prerequisites/ssh-keys.md rename to prereq/getting-access/ssh-keys.md index 3842282f..84909548 100644 --- a/part-1/prerequisites/ssh-keys.md +++ b/prereq/getting-access/ssh-keys.md @@ -1,9 +1,9 @@ --- layout: default title: Using SSH keys -parent: 1. Prerequisites -grand_parent: Part 1 -nav_order: 5 +parent: 1. Getting access +grand_parent: Prerequisites +nav_order: 3 permalink: /hands-on/connecting/ssh-keys.html --- diff --git a/part-1/prerequisites/ssh-puhti.md b/prereq/getting-access/ssh-puhti.md similarity index 99% rename from part-1/prerequisites/ssh-puhti.md rename to prereq/getting-access/ssh-puhti.md index dc2ae052..5fddc96b 100644 --- a/part-1/prerequisites/ssh-puhti.md +++ b/prereq/getting-access/ssh-puhti.md @@ -1,8 +1,8 @@ --- layout: default title: Login to Puhti -parent: 1. Prerequisites -grand_parent: Part 1 +parent: 1. Getting access +grand_parent: Prerequisites nav_order: 2 permalink: /hands-on/connecting/ssh-puhti.html --- diff --git a/prereq/index.md b/prereq/index.md new file mode 100644 index 00000000..81f69726 --- /dev/null +++ b/prereq/index.md @@ -0,0 +1,13 @@ +--- +layout: default +title: Prerequisites +nav_order: 2 +has_children: true +--- + +# Prerequisites + +New to CSC and Linux? Take some time to familiarize yourself with the +prerequisites. This section introduces how to get access to CSC supercomputers +and the basics of using a text-based Linux command-line interface (CLI). +{: .fs-6 .fw-300 } From 09e67944a81ccbd444c205a1db56faa59c8b41c9 Mon Sep 17 00:00:00 2001 From: Rasmus Kronberg Date: Thu, 1 Aug 2024 16:38:47 +0300 Subject: [PATCH 2/2] update basic linux commands --- index.md | 2 +- prereq/cli/basic-linux-commands.md | 184 +++++++++++++++++++++-------- prereq/cli/my-first-file.txt | 7 -- 3 files changed, 135 insertions(+), 58 deletions(-) delete mode 100644 prereq/cli/my-first-file.txt diff --git a/index.md b/index.md index e0d62bce..91d46260 100644 --- a/index.md +++ b/index.md @@ -16,7 +16,7 @@ Welcome! This website contains materials for the *CSC Computing Environment* ## Guidelines -1. The course is divided into two parts and the material is organized by topics of increasing complexity -- feel free to jump to Part 2 if you know the basics already! +1. The course is divided into two parts and the material is organized by topics of increasing complexity -- Feel free to jump to Part 2 if you know the basics already! 2. If you're completely new to CSC and working on a command-line, start by going through the Prerequisites. 3. In each topic, first read the slides / watch the video. 4. Complete the tutorial(s) to make sure you’ve got the steps right. diff --git a/prereq/cli/basic-linux-commands.md b/prereq/cli/basic-linux-commands.md index 703f538c..ac60feaa 100644 --- a/prereq/cli/basic-linux-commands.md +++ b/prereq/cli/basic-linux-commands.md @@ -9,92 +9,176 @@ permalink: /hands-on/linux_prerequisites/basic-linux-commands.html # Basic Linux commands -> ‼️ To begin make sure you have a [user account at CSC](https://docs.csc.fi/accounts/how-to-create-new-user-account/) that is a member of a project which [has access to the Puhti service](https://docs.csc.fi/accounts/how-to-add-service-access-for-project/). +> ‼️ To begin make sure you have a +> [user account at CSC](https://docs.csc.fi/accounts/how-to-create-new-user-account/) +> that is a member of a project which +> [has access to the Puhti service](https://docs.csc.fi/accounts/how-to-add-service-access-for-project/). -> ☝🏻 You should also have already [logged in to Puhti with SSH](https://csc-training.github.io/csc-env-eff/hands-on/connecting/ssh-puhti.html) or via the Puhti web interface (and opened a login node shell). +> ☝🏻 You should also have already +> [logged in to Puhti with SSH](https://csc-training.github.io/csc-env-eff/hands-on/connecting/ssh-puhti.html) +> or via the Puhti web interface (and opened a login node shell). -## Navigating folders +## Briefly about Linux commands + +CSC supercomputers use Linux operating systems. The traditional, and typically +most efficient, way of interacting with a Linux operating system is through a +text-based command-line interface (CLI), also called a *shell*. The user inputs +lines of text (commands), which are interpreted by the shell as directives for +the computer to execute a specific task. -1. Now that you have logged in to Puhti, check which folder you are in by typing `pwd` and hitting `Enter`: +The general syntax of Linux commands is: ```bash -pwd +command parameter1 parameter2 ... parameterN ``` -{:style="counter-reset:step-counter 1"} -2. Check if there are any files: +The parameters correspond to options or input arguments provided by the user +that alter the behavior of the command. They may be optional or mandatory. +Options are usually denoted by a single hyphen and a single character (e.g. +`command -o`). Some options may also have a longer, more descriptive +alternative prefixed by two hyphens (e.g. `command --option`). -```bash -ls -``` +Some commands allow single-character options to be combined. For example, +`command -o -p` could be written more succinctly as `command -op`. Otherwise, +any letter following an option would be interpreted as an argument for it. -{:style="counter-reset:step-counter 2"} -3. Make a directory and see if it appears: +Most Linux commands have their own manual page. If you at any point need help +with using a certain command, you can study its reference manual on the +command-line using `man`: ```bash -mkdir YourNameTestFolder # replace YourName -ls +man command ``` -{:style="counter-reset:step-counter 3"} -4. Go to that folder. +## Navigating folders -```bash -cd YourNameTestFolder # replace YourName -``` +1. Now that you have logged in to Puhti, check which folder (a.k.a. directory) + you are in by typing `pwd` (**p**rint **w**orking **d**irectory) and + hitting `Enter`: + + ```bash + pwd + ``` + +2. Probably you got `/users/` as the result (with `` + replaced by your actual CSC username). This is your *home* directory. + Different levels in the hierarchical directory tree are distinguished by the + forward-slash character `/`. The first `/` denotes the *root directory* -- + all other files and directories are located in subdirectories of this + directory so that each file has a unique combination of a name and a + directory path. + +3. Check if there are any files or subdirectories in your home directory by + typing the `ls` command (**l**i**s**t): + + ```bash + ls + ``` + +4. Create a new directory using the `mkdir` command (**m**a**k**e + **dir**ectory) and see if it appears: + + ```bash + mkdir my-test-folder + ls + ``` + +5. Go to that folder using the `cd` command (**c**hange **d**irectory). + + ```bash + cd my-test-folder + ``` + + 💡 Note: if you just type `cd` and the first few letters of the folder name, + then hit `Tab` key, the terminal completes the name. Handy! + +6. Various shorthand arguments are available for navigating directories. Return + to the *parent directory* (i.e. move one level up in the hierarchy) by using + the shorthand `../`: -💡 Note: if you just type `cd` and the first letter of the folder name, then hit `tab` key, the terminal completes the name. Handy! + ```bash + cd ../ + ``` + + 💡 To move multiple directories up, you would just repeat the pattern, e.g. + `cd ../../` to move two levels up. Note that a single dot `./` is used to + represent the current directory. + +7. Another useful shorthand is `~/` which denotes your home directory. Move + again into your new directory `my-test-folder` with: + + ```bash + cd ~/my-test-folder + ``` + + 💡 The previous command would work from any directory as it is essentially a + shorthand for giving the full path, `/users//my-test-folder`. ## Exploring files -1. Download a file into this new folder. Use the command `wget` for downloading from a URL: +1. Download a file into the `my-test-folder` directory. The command `wget` is a + convenient tool for downloading from a URL: -```bash -wget https://raw.githubusercontent.com/csc-training/csc-env-eff/master/part-1/prerequisites/my-first-file.txt -``` + ```bash + wget https://a3s.fi/CSC_training/my-first-file.txt + ``` -{:style="counter-reset:step-counter 1"} -2. Check what kind of file you got and what size it is using the `ls` command with some extra options: +2. Check what kind of file you got and what size it is using the `ls` command + with some extra options: -```bash -ls -lth # options are l for long format, t for sorting by time and h for convenient size units. Anything that starts with a hashtag is a comment and is not executed -``` + ```bash + ls -lth + ``` + + - `-l` is for long listing format + - `-t` is for sorting by time (most recently edited file first) + - `-h` is for convenient human-readable size units (also `--human-readable`) -{:style="counter-reset:step-counter 2"} 3. Use the `less` command to check out what the file looks like: -```bash -less my-first-file.txt -``` + ```bash + less my-first-file.txt + ``` -{:style="counter-reset:step-counter 3"} 4. To exit the `less` preview of the file, hit `q`. -💡 Tip: Instead of `less` you can use `cat` which prints the content of the file(s) straight into the command line. For long texts `less` is recommended. + 💡 Tip: Instead of `less` you can use `cat` which prints the content of the + file(s) directly on the command-line. For long texts `less` is recommended. -{:style="counter-reset:step-counter 4"} 5. Make a copy of this file: -```bash -cp my-first-file.txt YourName-first-file.txt # replace YourName -ls -lth -less YourName-first-file.txt # replace YourName -``` + ```bash + cp my-first-file.txt my-second-file.txt + ls -lth + less my-second-file.txt + ``` -{:style="counter-reset:step-counter 5"} 6. Remove the file we originally downloaded (leave your own copy). -```bash -rm my-first-file.txt -ls -``` + ```bash + rm my-first-file.txt + ls + ``` + + 💡 Tip: If you don't want to have duplicate files you can use `mv` to + **m**o**v**e and, optionally, rename files. The syntax is similar: -💡 Tip: If you don't want to have duplicate files you can use `mv` to 'move/rename' the file. Syntax is the same: `mv /path/to/source/oldname /path/to/destination/newname`. + ```bash + mv /path/to/source/oldname /path/to/destination/newname + ``` ## More information -- Learn [how to edit that file](https://csc-training.github.io/csc-env-eff/hands-on/linux_prerequisites/basic-file-editing.html) in the next tutorial! +* Learn + [how to edit that file](https://csc-training.github.io/csc-env-eff/hands-on/linux_prerequisites/basic-file-editing.html) + in the next tutorial! +* [Linux guide in Docs CSC](https://docs.csc.fi/support/tutorials/env-guide/) -💡 For more information of a given command line `command`: type `man command` or `command --help` where `command` is replaced with the one that you need help with. +💡 For more information of a given command-line `command`: type `man command` +or `command --help` where `command` is replaced with the one that you need help +with. -💡 Tip: If you remember *a part of a command* that you have used recently you can search for it with the command `history | grep string`. This will show all your used commands that have included the string `string` (replace this with the pattern you are searching for). +💡 Tip: If you remember *a part of a command* that you have used recently you +can search for it with the command `history | grep string`. This will show all +your used commands that have included the string `string` (replace this with +the pattern you are searching for). diff --git a/prereq/cli/my-first-file.txt b/prereq/cli/my-first-file.txt deleted file mode 100644 index cc57d103..00000000 --- a/prereq/cli/my-first-file.txt +++ /dev/null @@ -1,7 +0,0 @@ -Hi there! Good job! - -This is a test text file. You can play around with this file. - -You can try typing here with Nano, Emacs, Vim or another text editor! - -Write for example how you managed to open this file :)