---
colorlinks: true
---

###


```
$ figlet -f small "Shell for Fun and Profit"
 ___ _        _ _    __           ___          
/ __| |_  ___| | |  / _|___ _ _  | __|  _ _ _  
\__ \ ' \/ -_) | | |  _/ _ \ '_| | _| || | ' \ 
|___/_||_\___|_|_| |_| \___/_|   |_| \_,_|_||_|
                                                                
              _   ____          __ _ _   
 __ _ _ _  __| | |  _ \_ _ ___ / _(_) |_ 
/ _` | ' \/ _` | |   _/ '_/ _ \  _| |  _|
\__,_|_||_\__,_| | _| |_| \___/_| |_|\__|
                       
```

### Dieser Vortrag

Konfuse Liste von Herzensangelegenheiten

Bauchgefühl

Hoffentlich nicht _terrible_

. . .

TL;DR: Shell lernen = Fun and Profit

. . .

Gern interagieren :)

### Fragen in die Runde

Semester? Studiengang?

Wer nutzt meist Windows? Mac? Linux?

Vorerfahrung?

. . .

Terminal lesbar?

###

```
          $ cowsay -f milk Motivation
           ____________
          < Motivation >
           ------------
           \     ____________ 
            \    |__________|
                /           /\
               /           /  \
              /___________/___/|
              |          |     |
              |  ==\ /== |     |
              |   O   O  | \ \ |
              |     <    |  \ \|
             /|  \_____/ |  / /|
            //|          | / / |
           /|||          |/||\/|
              -------------|   
                  | |    | | 
                 <__/    \__>
```

###

![](gopro_naming.png)

###

![](devops-borat-excel.png)

###

![](pipeline.jpg)

###

```
$ cowsay demo
 ______
< demo >
 ------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
```

### Basics

- `.`, `..`
- `ls`, `cd`
- `touch`, `mkdir`, `cp`, `rm`, `mv`
- `*`, `?`
- `man`
- `cat`, `head`, `tail`
- `sort`, `uniq`, `grep`
- `>`, `>>`, `<`, `|`, `$( ... )`, `<( ... )`
- `if`, `for`, `||`, `&&`
- `$var`
- `&`
- _strg + r_

c.f. [Key Points: Shell, Git, ...](https://merely-useful.tech/py-rse/keypoints.html)

### Powertools

- `vim`: _der_ Texteditor. Gibt's als VS Code Plugin.
- `ranger`: Filemanager mit `vim`-keys
- `find`: listet Dateien auf
- `diff`, `vimdiff`: Unterschiede zwischen Dateien
- `make`: simples build system
- `curl`: http tool
- `jq`: json tool
- `pandoc`: document converter
- `yt-dlp`: youtube (etc) downloader
- `ffmpeg`: audio/video tool
- `imagick`: image tool
- `git`: VCS

####

- R, gnuplot, matplotlib
- PHP

####

- `shellcheck`

###

```
   .=gp.                   +------+
 .'/$$$$                   | Demo |
 || "TP"                   +------+
 ||          .:               ||
 ||       .-' |               ||
 ||    .-'    |               ||
 ||    |      !____
 ||    |   .-'  .-' 
 ||    '.____.-'(
 ||     \  /  /__\
 ||      )(
|::|    /__\           fsc
|::|
```

### Footguns

[ValveSoftware / steam-for-linux #3671](https://github.com/ValveSoftware/steam-for-linux/issues/3671)

. . .

#### Klassiker

Inputs, die mit `-` beginnen, e.g. `-bar`

Quoting von Variablen

Command fails, execution continues

::: notes

Demo

```sh
cd folger
rm *
echo everything clean in $pwd
```

:::

. . .

####

Nutzt `shellcheck`!

### Warum Shell/UNIX lernen?

#### Personal Computing

Shell interaktiv, effektiv

(Fast) alles wird programmierbar / "Apple-Effekt"

Kein [jpg2png.com](https://jpg2png.com/), [pdf-merge.com](https://www.pdf-merge.com/), ... mehr

#### Zinseszins

JS-Frameworks kommen und gehen, POSIX bleibt

## Right Tool for the Job$^{TM}$

### Blub-Paradoxon

hypothetical language "Blub" in the middle of the abstractness continuum.

A Blub programmer __looking down__ the power continuum __knows__ he's looking
down.

A Blub programmer __looking up__ the power continuum __doesn't realize__ he's
looking up. What he sees are merely weird languages. __He probably considers
them about equivalent__ in power to Blub, but with all this other hairy stuff thrown
in as well. Blub is good enough for him, because he __thinks in Blub__.

### Blub-Paradoxon abstracted

Well, es gibt _unknown unknowns_.

#### Tretroller vs Fahrrad

- Geschwindigkeit
- Preis

#### C vs Rust

- _Wat hab ich davon?_
- _Was kostet mich das lernen?_

### Werkzeuge

Turing-Vollständigkeit

| Domäne             | Problem            | Werkzeug   |
| -                  | -                  | -          |
| Holz schneiden     | Modellbau          | Laubsäge   |
| Holz schneiden     | Baum fällen        | Kettensäge |
| Daten verarbeiten  | Webshop            | LAMP       |
| Daten verarbeiten  | mp3s konkatenieren | shell      |

### Knuth vs McIlroy

> Read a file of text, determine the n most frequently used words, and print
> out a sorted list of those words along with their frequencies.

### Knuth vs McIlroy: Knuth's solution

![](knuth_solution.png)

### Knuth vs McIlroy: McIlroy's solution

```
tr -cs A-Za-z '\n' |
tr A-Z a-z |
sort |
uniq -c |
sort -rn |
sed ${1}q
```

### Knuth vs McIlroy: Aside

Possible reading: _Knuth is an idiot_

But: [Knuth was
framed](https://buttondown.email/hillelwayne/archive/donald-knuth-was-framed/)

Context matters!

[(Accompanying ACM article)](https://dl.acm.org/doi/10.1145/5948.315654)

### Werkzeuge

_Mensch_ nutzt _Werkzeug_ um _Umwelt_ zu beeinflussen.

| Tool               | Dev Env      | Umwelt          |
| -                  | -            | -               |
| Excel              | Tabelle      | Tabelle         |
| "Progra-like" Java | IDE          | Aufgabe         |
| Unix               | Shell        | Dateisystem, OS |
| Jupyter            | Notebook     | CSV, Plots      |
| Backend Webdev     | IDE, Postman | REST, ORM/SQL   |
| C / C++ / Rust     | IDE, perf    | Hardware        |

. . .

Kontext

::: notes

Einträge in Tabelle ein bisschen nach "Ansehen" / Komplexität geordnet.

:::

### Werkzeuge

> Each [tool] has its purpose, however humble. Each [tool] expresses the Yin
> and Yang of software. Each [tool] has its place within the Tao. 

[The Tao of Programming](https://www.mit.edu/~xela/tao.html)

## Demo: ytp

## Lernen

### Nextcloud o.ä. Self-hosten

#### Hardware

Home

0. Internetzugang mit IPv4
1. Hardware: RasPi / alter Laptop
2. Ubuntu LTS installieren
3. `ssh` einrichten
4. _Port forwarding_ am Router einstellen

Cloud

1. Mini-Instanz bei Hetzner, NetCup ([Sale!](https://www.netcup-sonderangebote.de/)), ...

#### Setup

1. DynDNS-Dienst raussuchen, einrichten
1. TLS-Zertifikat von Let's Encrypt holen
1. Nextcloud o.ä. nach Rezept installieren

### Linux als Daily Driver

1. Laptop beschaffen:
    - Alten Laptop rumliegen haben
    - Gebrauchten Business-Laptop holen _(z.B. Dell Latitude, Lenovo X240 / T440)_
    - All-in gehen
    - Dual boot
1. Distro raussuchen _(z.B. Ubuntu, Manjaro)_
1. Benutzen
    - Customizen
    - Scripten
    - [ricing](https://jie-fang.github.io/blog/basics-of-ricing) (c.f. [/r/unixporn](https://old.reddit.com/r/unixporn/))
    - Informieren: YouTube, Reddit, ...

### Mein Setup bis neulich

|   |   |
| - | - |
| Distro         | Manjaro        |
| window manager | [i3](i3wm.org) |
| Editor         | `vim`          |
| File manager   | [`ranger`](https://ranger.github.io/) |
| Music Player   | Erst [`moc`](http://moc.daper.net/), dann `mpd` mit `ncmcpp` |
| Video Player   | mpv       |
| PDF reader     | zathura   |
| Mailprogramm   | `mutt`    |
| Todos          | [`todoman`](https://github.com/pimutils/todoman) mit [vdirsyncer](https://vdirsyncer.readthedocs.org/) |
| Password Manager | [`pass`](https://www.passwordstore.org/) |
| Moodle Syncer    | [syncMyMoodle](https://github.com/Romern/syncMyMoodle) |

. . .

Btw: [isia](https://git.tu-berlin.de/freddy1404/isia-tub) bzw. [isisdl](https://github.com/Emily3403/isisdl/)

### Strategien

auf Linux _angewiesen_ sein

Lernprokrastination

Lieber 10h scripten/lernen als 10 * 10 min klicken

Lesen: `man(1)`, Bücher, Blogs

Verschränkungen

### Resourcen

- [Key Points: Shell, Git, ...](https://merely-useful.tech/py-rse/keypoints.html)
- ChatGPT
- [The Missing Semester](https://missing.csail.mit.edu/)
- [Software Carpentry Tutorial: Shell](https://swcarpentry.github.io/shell-novice/)
- [The AWK Programming Language](https://ia903404.us.archive.org/0/items/pdfy-MgN0H1joIoDVoIC7/The_AWK_Programming_Language.pdf?ref=itsfoss.com), insb. _Chapter 1_.
- [AT&T Archives: The UNIX Operating System](https://www.youtube.com/watch?v=tc4ROCJYbm0)

#### Für Linux

- [Arch Wiki](https://wiki.archlinux.org/)

