Skip to content

Commit 3b8ecfe

Browse files
committed
replaces nano with fresh
1 parent 93be687 commit 3b8ecfe

File tree

4 files changed

+20
-34
lines changed

4 files changed

+20
-34
lines changed

bash2.qmd

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Bash Unit 2
33
subtitle: Files and file systems
4-
execute:
4+
execute:
55
enabled: false
66
---
77

@@ -174,41 +174,22 @@ You may be used to a workflow where you first copy a file (e.g., Ctrl+C), then g
174174
Copy the file `gRNAs.txt` from your home directory into the directory `day2`. Then rename the copied file in this directory to `gRNAs_exercise.txt`.
175175

176176

177-
## Editing in nano
177+
## Editing in fresh
178178

179-
Now add a line at the end of the file `gRNAs.txt` that is located in your home directory, adding the gRNA sequence "ACTGACTG". Use the `nano` editor for this purpose. To quit the nano-editor you need to press Ctrl+X. Then type y+Enter to save the changes. Nano commands are shown in the editor and can be found on the internet. A list is provided below.
180-
181-
Nano commands:
182-
183-
Command | Function
184-
--- | ---
185-
ctrl+r | read/insert file
186-
ctrl+o | save file
187-
ctrl+x | close file
188-
alt+a | start selecting text
189-
ctrl+k | cut selection
190-
ctrl+u | uncut (paste) selection
191-
alt+/ | go to end of the file
192-
ctrl+a | go to start of the line
193-
ctrl+e | go to end of the line
194-
ctrl+c | show line number
195-
ctrl+_ | go to line number
196-
ctrl+w | find matching word
197-
alt+w | find next match
198-
ctrl+\ | find and replace
179+
Now add a line at the end of the file `gRNAs.txt` that is located in your home directory, adding the gRNA sequence "ACTGACTG". Use the [`fresh` editor](https://getfresh.dev/) for this purpose. Save your changes with Ctrl+S and quit the editor with Ctrl+Q.
199180

200181
```bash
201-
nano gRNAs.txt
182+
fresh gRNAs.txt
202183
```
203184

204-
Now use nano to modify the shell to make things prettier. To do so change the file `.bash_profile`. This file contains settings for each user (the naming is just by convention). It starts with a `.`, which for Linux means the file is hidden.
185+
Now use fresh to modify the shell to make things prettier. To do so change the file `.bash_profile`. This file contains settings for each user (the naming is just by convention). It starts with a `.`, which for Linux means the file is hidden.
205186

206187
```bash
207-
nano ~/.bash_profile
208-
# This creates the file and also opens it in nano
188+
fresh ~/.bash_profile
189+
# This creates the file and also opens it in fresh
209190
```
210191

211-
Add the following lines to `.bash_profile` in nano, then exit the file and save it - see the commands above.
192+
Add the following lines to `.bash_profile` in fresh, then exit the file and save it - see the commands above.
212193

213194
::: {.callout-tip}
214195
In Windows PowerShell, copy/paste works best if you enable the option to do so via Ctrl+Shift+V, as shown below.
@@ -238,10 +219,14 @@ ls -l
238219
ls -al
239220
```
240221

241-
::: {.callout-tip}
222+
::: {.callout-important}
242223
If your grade sheet does not show that the content of .bash_profile is correct but it still works, then leave it. There may be a small difference in between your version and the expected one that does not impact the functionality.
243224
:::
244225

226+
::: {.callout-tip}
227+
An older, but still very popular alternative to the fresh editor is [`nano`](https://www.nano-editor.org/). However, since fresh has a more intuitive user interface, we use the latter editor in this course.
228+
:::
229+
245230

246231

247232
## Zipped files
@@ -261,7 +246,7 @@ cp /resources/bash/Homo_sapiens.GRCh38.cds.all.fa.gz ~/
261246

262247
To make sure you have the entire file properly downloaded, compare the MD5 hash of the file. MD5 hash functions are a compact digital fingerprint of a file. The MD5 hash of the file should be `b16d46bf09c3b8b7909624f1e6c414ce`.
263248

264-
``` bash
249+
``` bash
265250
md5sum ~/Homo_sapiens.GRCh38.cds.all.fa.gz
266251
md5sum /resources/bash/Homo_sapiens.GRCh38.cds.all.fa.gz
267252
```
@@ -297,7 +282,7 @@ gunzip -c Homo_sapiens.GRCh38.cds.all.fa.gz
297282
man gunzip
298283
# -c --stdout --to-stdout
299284
# Write output on standard output; keep original files unchanged.
300-
# If there are several input files, the output consists of a sequence
285+
# If there are several input files, the output consists of a sequence
301286
# of independently compressed members. To obtain better compression,
302287
# concatenate all input files before compressing them.
303288
```

bash4.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Operator | Description | Example
7474
`-ge` | Checks if the value of left operand is greater than or equal to the value of right operand; if yes, then the condition becomes true. | `[ $a -ge $b ]` is not true.
7575
`-le` | Checks if the value of left operand is less than or equal to the value of right operand; if yes, then the condition becomes true. | `[ $a -le $b ]` is true.
7676

77-
You can also use nano to write the code above into a file (for example here: `script.sh`) and then use the following to execute it:
77+
You can also use fresh/nano to write the code above into a file (for example here: `script.sh`) and then use the following to execute it:
7878

7979
```bash
8080
bash script.sh

bash_reference.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Knowledge of these commands is required to pass both the exercises and exam.
1919
- `du`: calculate file size
2020
- `du -h`: display file size in a human-readable format
2121
- `echo`: display a line of text
22+
- `fresh`: edit a text file
2223
- `grep`: find a regular expression in a text file
2324
- `grep -E`: use extended regular expressions
2425
- `grep -v`: invert sense of matching, select non-matching lines

python1.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ print("Hello from the interactive shell")
3030
```
3131

3232
Script mode
33-
: Write Python commands into a text file (e.g., by using nano to create a file `my_program.py`). If you are still in the interactive mode: exit the python console by typing `exit()` or the key combination `Ctrl-D` (`Ctrl` is `Strg` on a German keyboard), then open and edit the file in a text editor such as nano.
33+
: Write Python commands into a text file (e.g., by using fresh/nano to create a file `my_program.py`). If you are still in the interactive mode: exit the python console by typing `exit()` or the key combination `Ctrl-D` (`Ctrl` is `Strg` on a German keyboard), then open and edit the file in a text editor such as fresh/nano.
3434
```bash
35-
nano my_program.py
35+
nano my_program.py # or: fresh my_program.py
3636
```
3737
Then enter python code into the file.
3838
```python
3939
print("Hello from the python script")
4040
```
41-
Then, exit nano to get back to the bash shell and pass the name of this file to the `python` command as argument:
41+
Then, exit fresh/nano to get back to the bash shell and pass the name of this file to the `python` command as argument:
4242
```bash
4343
python my_program.py
4444
```

0 commit comments

Comments
 (0)