|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "63b6499b-315e-4547-b171-aeeca54722b9", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# Additional Topics \n", |
| 9 | + "\n", |
| 10 | + "In this section, we will briefly touch on ten important topics in Unix/Bash that were not covered in this course. Each topic includes a brief description and links for further reading.\n", |
| 11 | + "\n", |
| 12 | + "1. **Path: `~/bin/`**\n", |
| 13 | + " - The `~/bin/` directory is a common location to place your own executable scripts or programs. Adding this directory to your `PATH` allows you to run your scripts from anywhere.\n", |
| 14 | + "\n", |
| 15 | + "2. **Hidden Files: `.bashrc`, `.bash_profile`**\n", |
| 16 | + " - Hidden files in Unix start with a dot (`.`). Important hidden files include `.bashrc` and `.bash_profile` which are used for configuring the shell environment.\n", |
| 17 | + "\n", |
| 18 | + "3. **Wildcard `{}`: `touch file-{001..100}`**\n", |
| 19 | + " - The `{}` wildcard is used for brace expansion, creating multiple files or directories with patterns.\n", |
| 20 | + " - Example: `touch file-{001..100}` creates files `file-001` to `file-100`.\n", |
| 21 | + "\n", |
| 22 | + "4. **Return Codes: `ks && echo \"done?\"`**\n", |
| 23 | + " - Commands return codes to indicate success or failure. `0` usually means success, and any other value indicates an error.\n", |
| 24 | + " - Example: `ks && echo \"done?\"` will echo \"done?\" if `ks` is successful.\n", |
| 25 | + "\n", |
| 26 | + "5. **Standard Input/Output and Redirection: `ks 2>&1 | cat`**\n", |
| 27 | + " - Input and output redirection allow you to control where the output of a command goes and where the input comes from.\n", |
| 28 | + " - Example: `ks 2>&1 | cat` redirects both standard output and standard error of `ks` to `cat`.\n", |
| 29 | + "\n", |
| 30 | + "6. **Job Control: `&, ps, fg, bg, kill`**\n", |
| 31 | + " - Job control allows you to manage multiple processes. You can start jobs in the background, bring them to the foreground, and kill them if necessary.\n", |
| 32 | + " - Commands: `&` (run in background), `ps` (list processes), `fg` (foreground), `bg` (background), `kill` (terminate process).\n", |
| 33 | + "\n", |
| 34 | + "7. **Environment Variables: `export`**\n", |
| 35 | + " - Environment variables are used to pass information into processes that are spawned from the shell.\n", |
| 36 | + " - Example: `export VAR=value` sets an environment variable.\n", |
| 37 | + "\n", |
| 38 | + "8. **Intro to Unix Filesystem**\n", |
| 39 | + " - The Unix filesystem is a hierarchical structure where everything is a file. Directories are special types of files.\n", |
| 40 | + "\n", |
| 41 | + "9. **Editors: `emacs` and `vim`: `vimtutor`**\n", |
| 42 | + " - `emacs` and `vim` are powerful text editors available in Unix. `vimtutor` is a great way to learn `vim`.\n", |
| 43 | + "\n", |
| 44 | + "10. **\"Magic\" Variables: `mkdir tmp_dir && cd $_`**\n", |
| 45 | + " - Magic variables like `$_` hold the last argument of the previous command.\n", |
| 46 | + " - Example: `mkdir tmp_dir && cd $_` creates a directory and then changes to it.\n", |
| 47 | + "\n", |
| 48 | + "11. **Bash Scripting: `if/else, while, case`**\n", |
| 49 | + " - Bash scripting allows for complex automation tasks using control structures like `if/else`, `while`, and `case`.\n", |
| 50 | + "\n", |
| 51 | + "12. **Line Endings and ASCII: `\\n\\r`**\n", |
| 52 | + " - Understanding line endings (`\\n` for Unix, `\\r\\n` for Windows) and ASCII is essential for text processing.\n", |
| 53 | + "\n", |
| 54 | + "13. **Calculations: `echo $((10**2 - 1))`**\n", |
| 55 | + " - Bash can perform arithmetic operations using `$((expression))`.\n", |
| 56 | + " - Example: `echo $((10**2 - 1))` calculates `10^2 - 1`.\n", |
| 57 | + "\n", |
| 58 | + "Each of these topics can be explored further to enhance your Unix and Bash skills.\n" |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "cell_type": "code", |
| 63 | + "execution_count": null, |
| 64 | + "id": "97a72fd9-94ec-4dab-ae47-4582ef6a90a0", |
| 65 | + "metadata": {}, |
| 66 | + "outputs": [], |
| 67 | + "source": [] |
| 68 | + } |
| 69 | + ], |
| 70 | + "metadata": { |
| 71 | + "kernelspec": { |
| 72 | + "display_name": "Python 3 (ipykernel)", |
| 73 | + "language": "python", |
| 74 | + "name": "python3" |
| 75 | + }, |
| 76 | + "language_info": { |
| 77 | + "codemirror_mode": { |
| 78 | + "name": "ipython", |
| 79 | + "version": 3 |
| 80 | + }, |
| 81 | + "file_extension": ".py", |
| 82 | + "mimetype": "text/x-python", |
| 83 | + "name": "python", |
| 84 | + "nbconvert_exporter": "python", |
| 85 | + "pygments_lexer": "ipython3", |
| 86 | + "version": "3.9.19" |
| 87 | + } |
| 88 | + }, |
| 89 | + "nbformat": 4, |
| 90 | + "nbformat_minor": 5 |
| 91 | +} |
0 commit comments