Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
"args": ["checks/fail_checks.md"],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Debug General",
"type": "debugpy",
"request": "launch",
"program": ".venv/bin/mkdocs",
"args": ["build"],
"console": "integratedTerminal",
"justMyCode": true
}
]
}
97 changes: 56 additions & 41 deletions docs/Tutorials/Introduction_To_HPC/Bash_Shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@

```out
Quota_Location AvailableGiB UsedGiB Use%
project_nesi99991 800 496 62

Check warning on line 86 in docs/Tutorials/Introduction_To_HPC/Bash_Shell.md

View workflow job for this annotation

GitHub Actions / Check Prose

lexical_illusions

'There's a lexical illusion in '6 6' - a phrase is repeated.'
nobackup_nesi99991 30720 16189 53
home_cwal219 20 13 65
```

As well as disk space, 'inodes' are also tracked, this is the *number* of files.

<!-- TODO fix this paragraph -->

Check warning on line 93 in docs/Tutorials/Introduction_To_HPC/Bash_Shell.md

View workflow job for this annotation

GitHub Actions / Check Prose

annotations.misc

'Annotation left in text.'
Notice that the project space for this user is over quota and has been locked, meaning no more data can be added.
When your space is locked you will need to move or remove data.
Also note that none of the nobackup space is being used.
Expand All @@ -106,7 +106,7 @@
First, let's find out where we are by running the command `pwd` for '**p**rint **w**orking **d**irectory'.

```sh
pwd
pwd
```

```out
Expand Down Expand Up @@ -141,7 +141,7 @@
We can use the following command to do this:

```sh
ls /nesi
ls {{ config.extra.working_directory[0] }}
```

```out
Expand All @@ -157,11 +157,14 @@

### 2.0: `ls` Reading Comprehension


![filetree](../../assets/images/tutorial_bash_shell_ex1.svg)

<quiz>

Given the below file tree.

![filetree](../../assets/images/tutorial_bash_shell_ex1.svg)
![filetree](../../assets/images/ABAQUS.png)

What command would you type to get the following output?

Expand Down Expand Up @@ -218,7 +221,7 @@

<!-- NOTE: This bit uses relative paths even though the concept hasn't been introduced yet. -->

As previously mentioned, it is general useful to organise your work in a hierarchical file structure to make managing and finding files easier.

Check warning on line 224 in docs/Tutorials/Introduction_To_HPC/Bash_Shell.md

View workflow job for this annotation

GitHub Actions / Check Prose

spelling.consistency

'Inconsistent spelling of 'organize' (vs. 'organise').'
It is also is especially important when working within a shared directory with colleagues, such as a project, to minimise the chance of accidentally affecting your colleagues work.
So for this tutorial you will each make a directory using the `mkdir` command within your project's nobackup directory for you to personally work from.

Expand Down Expand Up @@ -299,20 +302,28 @@

These two specific hidden directories are special as they will exist hidden inside every directory, with the `.` hidden directory representing your current directory and the `..` hidden directory representing the **parent** directory above your current directory.

!!! question "Exploring More `ls` Flags"
You can also use two options at the same time. What does the command `ls` do when used
with the `-l` option? What about if you use both the `-l` and the `-h` option?
<quiz>

### question "Exploring More `ls` Flags"

Some of its output is about properties that we do not cover in this lesson (such
as file permissions and ownership), but the rest should be useful
nevertheless.
You can also use two options at the same time. What does the command `ls` do when used
with the `-l` option? What about if you use both the `-l` and the `-h` option?

??? question "Solution"
The `-l` option makes `ls` use a **l**ong listing format, showing not only
the file/directory names but also additional information, such as the file size
and the time of its last modification. If you use both the `-h` option and the `-l` option,
this makes the file size '**h**uman readable', i.e. displaying something like `5.3K`
instead of `5369`.
Some of its output is about properties that we do not cover in this lesson (such
as file permissions and ownership), but the rest should be useful
nevertheless.

- [X] Long-List
- [X] Human readable.
- [] Show Symlinks.
- [] Show Help page.

The `-l` option makes `ls` use a **l**ong listing format, showing not only
the file/directory names but also additional information, such as the file size
and the time of its last modification. If you use both the `-h` option and the `-l` option,
this makes the file size '**h**uman readable', i.e. displaying something like `5.3K`
instead of `5369`.
</quiz>

## Relative paths

Expand Down Expand Up @@ -353,7 +364,7 @@

## Tab completion

Sometimes file paths and file names can be very long, making typing out the path tedious.

Check warning on line 367 in docs/Tutorials/Introduction_To_HPC/Bash_Shell.md

View workflow job for this annotation

GitHub Actions / Check Prose

weasel_words.very

'Substitute 'damn' every time you're inclined to write 'very'; your editor will delete it and the writing will be just as it should be.'
One trick you can use to save yourself time is to use something called **tab completion**.
If you start typing the path in a command and there is only one possible match,
if you hit tab the path will autocomplete (until there are more than one possible matches).
Expand Down Expand Up @@ -402,29 +413,33 @@

Another shortcut is the `-` (dash) character. `cd` will translate `-` into
*the previous directory I was in*, which is faster than having to remember,
then type, the full path. This is a *very* efficient way of moving

Check warning on line 416 in docs/Tutorials/Introduction_To_HPC/Bash_Shell.md

View workflow job for this annotation

GitHub Actions / Check Prose

typography.punctuation.spacing

'Inconsistent spacing after period (1 vs. 2 spaces).'
*back and forth between two directories* -- i.e. if you execute `cd -` twice,
you end up back in the starting directory.

The difference between `cd ..` and `cd -` is
that the former brings you *up*, while the latter brings you *back*.

!!! question "Absolute vs Relative Paths"
Starting from `/home/amanda/data`,
which of the following commands could Amanda use to navigate to her home directory,
which is `/home/amanda`?

1. `cd .`
2. `cd /`
3. `cd home/amanda`
4. `cd ../..`
5. `cd ~`
6. `cd home`
7. `cd ~/data/..`
8. `cd`
9. `cd ..`
<quiz >

### question "Absolute vs Relative Paths"

??? question "Solution"
Starting from `/home/amanda/data`,
which of the following commands could Amanda use to navigate to her home directory,
which is `/home/amanda`?

- [] `cd .`
- [] `cd /`
- [] `cd home/amanda`
- [] `cd ../..`
- [X] `cd ~`
- [] `cd home`
- [X] `cd ~/data/..`
- [X] `cd`
- [X] `cd ..`


1. No: `.` stands for the current directory.
2. No: `/` stands for the root directory.
3. No: Amanda's home directory is `/home/amanda`.
Expand All @@ -434,20 +449,20 @@
7. Yes: unnecessarily complicated, but correct.
8. Yes: shortcut to go back to the user's home directory.
9. Yes: goes up one level.
{: .solution}
{: .challenge}
</quiz>

!!! question "Relative Path Resolution"
Using the filesystem diagram below, if `pwd` displays `/Users/thing`,
what will `ls ../backup` display?

1. `../backup: No such file or directory`
2. `2012-12-01 2013-01-08 2013-01-27`
3. `original pnas_final pnas_sub`
<quiz>
### Relative Path Resolution

![alt text](../../assets/images/tutorial_bash_shell_ex1.svg)
Using the filesystem diagram below, if `pwd` displays `/Users/thing`,
what will `ls ../backup` display?

??? question Solution
![alt text](../../assets/images/tutorial_bash_shell_ex1.svg)

- [] `../backup: No such file or directory`
- [] `2012-12-01 2013-01-08 2013-01-27`
- [X] `original pnas_final pnas_sub`

1. No: there *is* a directory `backup` in `/Users`.
2. No: this is the content of `Users/thing/backup`,
but with `..`, we asked for one level further up.
Expand Down Expand Up @@ -623,7 +638,7 @@
(we'll be asked what file we want to save this to:
press <kbd>Return</kbd> to accept the suggested default of `draft.txt`).

<div>src="../../Getting_Started/Getting_Help/Training/fig/nano-screenshot.png"></div>
[](../../assets/images/nano-screenshot.png)

Once our file is saved, we can use <kbd>Ctrl</kbd>+<kbd>X</kbd> to quit the editor and
return to the shell.
Expand Down
Binary file added docs/assets/images/nano-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading