Add lesson 6: Processes and jobs

Sam Okafor 1 year ago
parent 9bb95a54ff commit 3b3d68c47fc4e86705e6e79a4d8652a242f83280
3 changed files with 30 additions and 0 deletions
+19-0lessons/06-processes-and-jobs/README.md ADDED
@@ -0,0 +1,19 @@
1+# Lesson 6: Processes and jobs
2+
3+This lesson covers processes and jobs. You'll read a short explanation, try three small exercises and finish with a quiz.
4+
5+Full lesson: [https://glibcode.net/courses/linux-shell/lessons/6](https://glibcode.net/courses/linux-shell/lessons/6)
6+
7+## Files
8+
9+- `commands.sh`: ps, top, kill and background jobs
10+
11+## Run it
12+
13+```sh
14+# type the commands from commands.sh one by one; don't run it as a script
15+```
16+
17+## Exercises
18+
19+See [exercises.md](exercises.md). Ask in the forum once you've tried.
+6-0lessons/06-processes-and-jobs/commands.sh ADDED
@@ -0,0 +1,6 @@
1+ps aux | grep python
2+top -o %CPU
3+sleep 300 & # start in the background
4+jobs
5+fg %1 # bring it back, Ctrl+Z to pause, bg to continue
6+kill -TERM 12345
+5-0lessons/06-processes-and-jobs/exercises.md ADDED
@@ -0,0 +1,5 @@
1+# Exercises: lesson 6
2+
3+1. Rewrite the main part so it runs twice with two different inputs, without copying the code.
4+2. What happens with an empty input? Change the code so it handles that case with a clear message.
5+3. Time yourself: rewrite the example from memory in 10 minutes, then diff it against the original.