Compare commits
10 commits
8cb56d003f
...
6e709b1b27
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e709b1b27 | |||
| 94e19663cd | |||
| 66ff90b1c8 | |||
| 1c0ddbec64 | |||
| 6815de777b | |||
| 1df5856100 | |||
| f4575bf71a | |||
| 676838e6ba | |||
| d894e5ff2d | |||
| 679d9a996a |
6 changed files with 434 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
@use "sass:map"
|
@use "sass:map"
|
||||||
@use "sass:color"
|
@use "sass:color"
|
||||||
|
|
||||||
@use 'org-media-sass/default-org-mode'
|
@use 'org-media-sass/org-base' as *
|
||||||
|
|
||||||
@use 'org-media-sass/themes/desert-oasis' as *
|
@use 'org-media-sass/themes/desert-oasis' as *
|
||||||
@use 'org-media-sass/fonts' as fonts
|
@use 'org-media-sass/fonts' as fonts
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit c51abd0a595cc9c782198b43620acc29c411acd6
|
Subproject commit 9a1a53af49c8a887dd129e9ade15f7b49cae1a13
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/missing-semester.css" />
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/missing-semester.css" />
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/org-media-sass/collapsible.css" />
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/org-media-sass/collapsible.css" />
|
||||||
#+HTML_HEAD: <script src="../_share/media/js/collapsible.js"></script>
|
#+HTML_HEAD: <script src="../_share/media/js/collapsible.js"></script>
|
||||||
|
#+OPTIONS: H:6
|
||||||
|
|
||||||
* Links
|
* Links
|
||||||
#+attr_html: :class links
|
#+attr_html: :class links
|
||||||
|
|
@ -31,8 +32,8 @@
|
||||||
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=1707s][28:27 - man command]]
|
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=1707s][28:27 - man command]]
|
||||||
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2175s][31:26 - finding files]]
|
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2175s][31:26 - finding files]]
|
||||||
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2190s][36:30 - grep]]
|
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2190s][36:30 - grep]]
|
||||||
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2573s][42:53 - fuzzy finder]] *current*
|
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2573s][42:53 - fuzzy finder]]
|
||||||
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2649s][44:09 - history substring search]]
|
+ [[https://www.youtube.com/watch?v=kgII-YWo3Zw&t=2649s][44:09 - history substring search]] *current*
|
||||||
|
|
||||||
* Notes
|
* Notes
|
||||||
|
|
||||||
|
|
@ -359,3 +360,273 @@ shellcheck some_bash_script.sh
|
||||||
- ag
|
- ag
|
||||||
|
|
||||||
** fuzzy finder
|
** fuzzy finder
|
||||||
|
|
||||||
|
*** Overview of fzf
|
||||||
|
|
||||||
|
fzf is a fuzzy finder for the command line. It allows quick searching through lists (files, command history, processes, etc.) using an interactive interface. Unlike traditional search tools that require exact matches, fzf uses fuzzy matching, meaning you only need to type parts of what you're looking for, and it will find the closest match.
|
||||||
|
|
||||||
|
*** Why Use fzf?
|
||||||
|
- Fast and efficient, even for thousands of files or lines.
|
||||||
|
- Highly customizable, works with various CLI tools (find, grep, git, history, etc.).
|
||||||
|
- Interactive, allowing navigation with arrow keys or Ctrl-N / Ctrl-P.
|
||||||
|
- Minimal setup required, just install and start using it.
|
||||||
|
|
||||||
|
*** Test Commands to Try in fzf
|
||||||
|
|
||||||
|
**** Basic Usage
|
||||||
|
|
||||||
|
1. **Search files in the current directory**
|
||||||
|
#+begin_src sh
|
||||||
|
fzf
|
||||||
|
#+end_src
|
||||||
|
Opens an interactive search where you can start typing to filter through files.
|
||||||
|
|
||||||
|
2. **Search your command history**
|
||||||
|
#+begin_src sh
|
||||||
|
history | fzf
|
||||||
|
#+end_src
|
||||||
|
Lets you browse and select previously used commands.
|
||||||
|
|
||||||
|
3. **Find and open a file in Vim**
|
||||||
|
#+begin_src sh
|
||||||
|
vim $(fzf)
|
||||||
|
#+end_src
|
||||||
|
Searches for a file and opens it in Vim.
|
||||||
|
|
||||||
|
4. **Search running processes**
|
||||||
|
#+begin_src sh
|
||||||
|
ps aux | fzf
|
||||||
|
#+end_src
|
||||||
|
Lets you search for running processes.
|
||||||
|
|
||||||
|
5. **Find a Git-tracked file**
|
||||||
|
#+begin_src sh
|
||||||
|
git ls-files | fzf
|
||||||
|
#+end_src
|
||||||
|
Searches only files tracked by Git.
|
||||||
|
|
||||||
|
**** Advanced Usage
|
||||||
|
|
||||||
|
6. **Find and delete a file**
|
||||||
|
#+begin_src sh
|
||||||
|
rm -i $(fzf)
|
||||||
|
#+end_src
|
||||||
|
Select a file to delete (prompts before deletion).
|
||||||
|
|
||||||
|
7. **Search and kill a process**
|
||||||
|
#+begin_src sh
|
||||||
|
kill -9 $(ps aux | fzf | awk '{print $2}')
|
||||||
|
#+end_src
|
||||||
|
Finds a process and terminates it.
|
||||||
|
|
||||||
|
8. **Use fzf with ripgrep (fast file search)**
|
||||||
|
#+begin_src sh
|
||||||
|
rg --files | fzf
|
||||||
|
#+end_src
|
||||||
|
Searches only through files tracked by ripgrep.
|
||||||
|
|
||||||
|
9. **Preview file contents while searching**
|
||||||
|
#+begin_src sh
|
||||||
|
fzf --preview "bat --style=numbers --color=always {}"
|
||||||
|
#+end_src
|
||||||
|
Uses bat (a better cat) to preview file contents.
|
||||||
|
|
||||||
|
*** Customizing fzf
|
||||||
|
|
||||||
|
**** Set up a keybinding (Ctrl+T) to trigger fzf for file selection
|
||||||
|
#+begin_src sh
|
||||||
|
bind '"\C-t": "fzf\n"'
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
**** Change fzf options to improve display
|
||||||
|
#+begin_src sh
|
||||||
|
export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border"
|
||||||
|
#+end_src
|
||||||
|
- --height 40%: Shows results in a smaller window.
|
||||||
|
- --layout=reverse: Shows matches from the bottom up.
|
||||||
|
- --border: Adds a visible border.
|
||||||
|
|
||||||
|
*** Final Thoughts
|
||||||
|
- fzf is a powerful tool for navigating files, commands, and processes.
|
||||||
|
- Once installed, just type fzf anywhere in the terminal and start filtering.
|
||||||
|
- Combine it with other commands for maximum efficiency.
|
||||||
|
|
||||||
|
** tree
|
||||||
|
*** Overview of tree
|
||||||
|
|
||||||
|
tree is a command-line utility that displays directory structures in a tree-like format. It recursively lists files and directories, making it useful for visualizing folder hierarchies.
|
||||||
|
|
||||||
|
*** Why Use tree?
|
||||||
|
- Provides a clear hierarchical view of files and directories.
|
||||||
|
- Supports filtering by file type, depth, and patterns.
|
||||||
|
- Can output results in various formats such as JSON and XML.
|
||||||
|
- Useful for quickly understanding directory structures.
|
||||||
|
|
||||||
|
*** Test Commands to Try in tree
|
||||||
|
|
||||||
|
**** Basic Usage
|
||||||
|
|
||||||
|
1. **Display the directory structure from the current location**
|
||||||
|
#+begin_src sh
|
||||||
|
tree
|
||||||
|
#+end_src
|
||||||
|
Lists all files and folders in a tree format.
|
||||||
|
|
||||||
|
2. **Limit the depth of displayed directories**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -L 2
|
||||||
|
#+end_src
|
||||||
|
Shows only two levels of the directory structure.
|
||||||
|
|
||||||
|
3. **Show hidden files in the tree**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -a
|
||||||
|
#+end_src
|
||||||
|
Displays all files, including hidden ones (those starting with a dot).
|
||||||
|
|
||||||
|
4. **Display file sizes and permissions**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -h -p
|
||||||
|
#+end_src
|
||||||
|
Shows human-readable file sizes along with permission flags.
|
||||||
|
|
||||||
|
5. **List only directories**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -d
|
||||||
|
#+end_src
|
||||||
|
Displays only directories, excluding files.
|
||||||
|
|
||||||
|
**** Advanced Usage
|
||||||
|
|
||||||
|
6. **Output the tree structure to a file**
|
||||||
|
#+begin_src sh
|
||||||
|
tree > structure.txt
|
||||||
|
#+end_src
|
||||||
|
Saves the tree output to a text file for later reference.
|
||||||
|
|
||||||
|
7. **Generate JSON output**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -J
|
||||||
|
#+end_src
|
||||||
|
Outputs the directory structure in JSON format.
|
||||||
|
|
||||||
|
8. **Filter by file extension**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -P "*.txt"
|
||||||
|
#+end_src
|
||||||
|
Lists only `.txt` files within the directory structure.
|
||||||
|
|
||||||
|
9. **Exclude certain files or directories**
|
||||||
|
#+begin_src sh
|
||||||
|
tree -I "node_modules"
|
||||||
|
#+end_src
|
||||||
|
Hides the `node_modules` directory from the output.
|
||||||
|
|
||||||
|
*** Customizing tree
|
||||||
|
|
||||||
|
**** Set an alias for a commonly used tree command
|
||||||
|
#+begin_src sh
|
||||||
|
alias t2="tree -L 2"
|
||||||
|
#+end_src
|
||||||
|
Creates an alias `t2` to quickly show two levels of the directory.
|
||||||
|
|
||||||
|
**** Change default colors in tree output
|
||||||
|
#+begin_src sh
|
||||||
|
export TREE_COLORS="di=1;34:ln=1;36:fi=0;37"
|
||||||
|
#+end_src
|
||||||
|
Customizes the colors used in the tree display for directories, links, and files.
|
||||||
|
|
||||||
|
*** Final Thoughts
|
||||||
|
- tree is a powerful tool for quickly understanding directory structures.
|
||||||
|
- It is useful for documentation, debugging, and navigating complex file systems.
|
||||||
|
- The command supports various output formats, filtering, and customization options.
|
||||||
|
|
||||||
|
** broot
|
||||||
|
*** Overview of broot
|
||||||
|
|
||||||
|
broot is a command-line tool for navigating and managing directory structures efficiently. It provides a tree-like view of files and directories while allowing fuzzy searching, filtering, and file operations within the terminal.
|
||||||
|
|
||||||
|
*** Why Use broot?
|
||||||
|
- Provides an interactive tree view of directories with better readability than `ls` or `tree`.
|
||||||
|
- Allows fuzzy searching and filtering of files and directories.
|
||||||
|
- Supports file operations (e.g., rename, delete, move) directly from the interface.
|
||||||
|
- Can replace `cd` by letting you navigate and enter directories quickly.
|
||||||
|
- Supports customizable keybindings and themes.
|
||||||
|
|
||||||
|
*** Test Commands to Try in broot
|
||||||
|
|
||||||
|
**** Basic Usage
|
||||||
|
|
||||||
|
1. **Launch broot**
|
||||||
|
#+begin_src sh
|
||||||
|
broot
|
||||||
|
#+end_src
|
||||||
|
Opens an interactive directory tree view.
|
||||||
|
|
||||||
|
2. **Navigate the file system with fuzzy search**
|
||||||
|
#+begin_src sh
|
||||||
|
broot
|
||||||
|
#+end_src
|
||||||
|
Start typing part of a file or directory name to filter results.
|
||||||
|
|
||||||
|
3. **Enter a directory from broot**
|
||||||
|
#+begin_src sh
|
||||||
|
br
|
||||||
|
#+end_src
|
||||||
|
If `br` is set up as a shell function, it allows `cd` replacement.
|
||||||
|
|
||||||
|
4. **Show hidden files**
|
||||||
|
#+begin_src sh
|
||||||
|
broot --hidden
|
||||||
|
#+end_src
|
||||||
|
Displays hidden files and directories.
|
||||||
|
|
||||||
|
5. **Only show directories**
|
||||||
|
#+begin_src sh
|
||||||
|
broot --only-folders
|
||||||
|
#+end_src
|
||||||
|
Filters out non-directory files from the view.
|
||||||
|
|
||||||
|
**** Advanced Usage
|
||||||
|
|
||||||
|
6. **Perform file operations within broot**
|
||||||
|
- Press `:rename` to rename a file.
|
||||||
|
- Press `:delete` to remove a file.
|
||||||
|
- Use `:move target_directory` to move a file.
|
||||||
|
|
||||||
|
7. **Find and open a file in an editor**
|
||||||
|
#+begin_src sh
|
||||||
|
broot --cmd "edit file_name"
|
||||||
|
#+end_src
|
||||||
|
Searches and opens a file using the default editor.
|
||||||
|
|
||||||
|
8. **Integrate broot with `cd` command**
|
||||||
|
#+begin_src sh
|
||||||
|
broot --install
|
||||||
|
#+end_src
|
||||||
|
Enables `br` to work as a replacement for `cd`.
|
||||||
|
|
||||||
|
9. **Customize broot settings**
|
||||||
|
#+begin_src sh
|
||||||
|
broot --edit-conf
|
||||||
|
#+end_src
|
||||||
|
Opens the broot configuration file for customization.
|
||||||
|
|
||||||
|
*** Customizing broot
|
||||||
|
|
||||||
|
**** Change default display options
|
||||||
|
#+begin_src sh
|
||||||
|
broot --set-default-flags "gh"
|
||||||
|
#+end_src
|
||||||
|
Sets the default view to show hidden files and a grid layout.
|
||||||
|
|
||||||
|
**** Define a shortcut for frequently used commands
|
||||||
|
#+begin_src sh
|
||||||
|
alias bcd='broot --cmd "cd"'
|
||||||
|
#+end_src
|
||||||
|
Creates an alias to quickly navigate directories.
|
||||||
|
|
||||||
|
*** Final Thoughts
|
||||||
|
- broot is a powerful alternative to `ls`, `tree`, and `cd`, offering an interactive way to browse and manage files.
|
||||||
|
- With fuzzy search and built-in file operations, it enhances productivity for command-line users.
|
||||||
|
- Customization options allow tailored keybindings and themes for better usability.
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,92 @@
|
||||||
#+title: Lesson 02 | shell tools and scripting
|
#+title: Lesson 03 | text editors (vim)
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/missing-semester.css" />
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/missing-semester.css" />
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/org-media-sass/collapsible.css" />
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/org-media-sass/collapsible.css" />
|
||||||
#+HTML_HEAD: <script src="../_share/media/js/collapsible.js"></script>
|
#+HTML_HEAD: <script src="../_share/media/js/collapsible.js"></script>
|
||||||
|
#+OPTIONS: H:6
|
||||||
|
|
||||||
* Links
|
* Links
|
||||||
#+attr_html: :class links
|
#+attr_html: :class links
|
||||||
- [[../toc.org][TOC | Missing Semester]]
|
- [[../toc.org][TOC | Missing Semester]]
|
||||||
- [[https://www.youtube.com/playlist?list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J][Playlist: Missing Semester]]
|
- [[https://www.youtube.com/playlist?list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J][Playlist: Missing Semester]]
|
||||||
|
- [[https://missing.csail.mit.edu/2020/editors/][class notes]]
|
||||||
|
|
||||||
* Notes
|
- Curr: https://youtu.be/a6Q8Na575qc?si=B-yLC3sGZxqQhOTb&t=2258
|
||||||
|
|
||||||
|
|
||||||
*** Playlist
|
*** timestamps
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: timestamp
|
||||||
|
:END:
|
||||||
|
|
||||||
#+attr_html: :class playlist
|
#+attr_html: :class playlist
|
||||||
1. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=20s][why we're doing this class]]
|
+ [[https://www.youtube.com/watch?v=a6Q8Na575qc][00:00 - introduction]]
|
||||||
2. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=251s][the shell]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=qzD5HiycrEhplKeQ&t=285][04:45 - modal editor]]
|
||||||
3. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=338s][install a terminal and a shell]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=ra-MbPQpbKzAcJnP&t=571][09:30 - opening vim]]
|
||||||
4. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=411s][shell prompt]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=OyhOfX2ft9w7O9kM&t=1020][17:00 - buffers vs windows]]
|
||||||
5. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=522s][how does the shell know what these programs are]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=gyYNZk4_XiXVk_4a&t=1217][20:17 - movement keys]]
|
||||||
6. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=672s][paths]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=QysgH5bMEG0bigKq&t=1530][25:30 - editing commands]]
|
||||||
7. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=738s][absolute path]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=_gbAQlOZ_irCdHt6&t=1797][29:54 - questions]]
|
||||||
8. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=759s][relative paths]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=4VwNEC040Jna5znz&t=2254][37:33 - demo]]
|
||||||
9. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1034s][tilde character]]
|
+ [[https://youtu.be/a6Q8Na575qc?si=0qDOcyT0WX1U4RXB&t=2682][44:42 - vim configuration]]
|
||||||
10. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1336s][directories]]
|
|
||||||
11. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1376s][execute on directories]]
|
* notes
|
||||||
12. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1514s][cp command]]
|
|
||||||
13. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1547s][rm]]
|
** modes
|
||||||
14. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1590s][create a new directory]]
|
*** normal mode
|
||||||
15. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=1912s][pipe character]]
|
- not editing directly
|
||||||
16. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2044s][grep]]
|
- default
|
||||||
17. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2145s][the root user]]
|
- get to it via ESC
|
||||||
18. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2239s][kernel paramters]]
|
*** insert mode
|
||||||
19. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2612s][scroll lock led]]
|
- i
|
||||||
20. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2706s][open a file]]
|
- pushes text aside
|
||||||
21. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2829s][lecture notes]]
|
*** replace mode
|
||||||
22. [[https://www.youtube.com/watch?v=Z56Jmr9Z34Q&list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J&t=2875s][office hours]]
|
- R (capital 'r')
|
||||||
|
- overwrites text
|
||||||
|
*** visual mode
|
||||||
|
- line visual: Shift+V
|
||||||
|
- goes by line
|
||||||
|
- block visual: Ctrl+V
|
||||||
|
- allows you to select vertical and horizontal
|
||||||
|
*** command line
|
||||||
|
|
||||||
|
** opening vim
|
||||||
|
|
||||||
|
- entered via ':'
|
||||||
|
|
||||||
|
** buffers vs windows
|
||||||
|
- vim maintains a set of open buffers
|
||||||
|
- any buffer can be open in 0 or more windows at any time
|
||||||
|
- you can have tabs, and tabs can contain windows
|
||||||
|
|
||||||
|
*** quiting
|
||||||
|
- :q only closes the current WINDOW, not buffer
|
||||||
|
- :q exits when there are no more windows open
|
||||||
|
- :qa is "quit all" and closes all windows
|
||||||
|
|
||||||
|
** movement
|
||||||
|
- hjkl
|
||||||
|
- w/b forward and backward by one word
|
||||||
|
- e end of word
|
||||||
|
- 0/$ beginning and end of line
|
||||||
|
- ^ first non empty character on a line
|
||||||
|
|
||||||
|
*** scrolling up and down
|
||||||
|
- C+U move up
|
||||||
|
- C+D move down
|
||||||
|
|
||||||
|
*** move by buffer
|
||||||
|
- G moves to end of buffer
|
||||||
|
- gg move to top of buffer
|
||||||
|
|
||||||
|
*** move by screen
|
||||||
|
- L moves to lowest line on screen
|
||||||
|
- M moves to middle line on screen
|
||||||
|
- H moves to the highest on screen
|
||||||
|
|
||||||
|
*** move by find
|
||||||
|
- f <letter> will move to the first letter forward
|
||||||
|
- F <letter> backwards
|
||||||
|
- t <letter> moves to just before the letter
|
||||||
|
- T <letter> moves backwards to in front of the letter
|
||||||
|
|
||||||
|
** editing commands
|
||||||
|
|
|
||||||
78
_subsections/lesson-04.org
Normal file
78
_subsections/lesson-04.org
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
#+title: Lesson 04 | Data Wrangling
|
||||||
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/missing-semester.css" />
|
||||||
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../_share/media/css/org-media-sass/collapsible.css" />
|
||||||
|
#+HTML_HEAD: <script src="../_share/media/js/collapsible.js"></script>
|
||||||
|
#+OPTIONS: H:6
|
||||||
|
|
||||||
|
* Links
|
||||||
|
#+attr_html: :class links
|
||||||
|
- [[../toc.org][TOC | Missing Semester]]
|
||||||
|
- [[https://www.youtube.com/playlist?list=PLyzOVJj3bHQuloKGG59rS43e29ro7I57J][Playlist: Missing Semester]]
|
||||||
|
- [[https://missing.csail.mit.edu/2020/data-wrangling/][class notes]]
|
||||||
|
|
||||||
|
- Curr: https://youtu.be/sz_dsktIjt4?si=oVhYD6bPPM6FzWSL&t=1325
|
||||||
|
|
||||||
|
*** timestamps
|
||||||
|
:PROPERTIES:
|
||||||
|
:CUSTOM_ID: timestamp
|
||||||
|
:END:
|
||||||
|
|
||||||
|
#+attr_html: :class playlist
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=4s][00:00 - introduction]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=415s][06:55 - Stream Editor]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=456s][07:36 - Replacement Expressions]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=538s][08:58 - Regular Expression]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=560s][09:20 - Regular Expressions]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=620s][10:20 - Square Brackets]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=693s][11:33 - Add Modifiers]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=776s][12:56 - Alternations]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=1029s][17:09 - Anchoring the Regular Expression]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=1138s][18:58 - Capture Groups]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=1215s][20:15 - Regular Expression Debugger]] *current*
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=1450s][24:10 - Regular Sessions]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=1561s][26:01 - Match and Email Address ]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=1743s][29:03 - Sort]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2040s][34:00 - Awk]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2324s][38:44 - Berkeley Calculator]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2437s][40:37 - Computer Statistics over Inputs]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2482s][41:22 - Summary Statistics]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2513s][41:53 - Plotting]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2570s][42:50 - Two sort of special types]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2754s][45:54 - example where data wrangling is useful]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2805s][46:45 - image captures to standard output]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2846s][47:26 - operate on standard input]]
|
||||||
|
+ [[https://www.youtube.com/watch?v=sz_dsktIjt4&t=2880s][48:00 - display in an image display]]
|
||||||
|
|
||||||
|
* notes
|
||||||
|
** intro example
|
||||||
|
- using ssh someserver 'somecommand' will run that command on the server
|
||||||
|
- you could run a series of commands on the server instead of channeling all that info back
|
||||||
|
|
||||||
|
#+BEGIN_SRC bash
|
||||||
|
ssh someserver 'journalctl | grep sshd | grep "Disconnected from"' | less
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
- this will run journalctl on the server, find anything that says 'sshd' and 'disconnec..' in the results
|
||||||
|
- then send all those results back to our machine where we pipe it through 'less'
|
||||||
|
|
||||||
|
** SED
|
||||||
|
- stream editor
|
||||||
|
- allows you to make changes to the contents of a stream
|
||||||
|
- full programming langauge
|
||||||
|
- common task is to run replacement expressions on an input stream
|
||||||
|
|
||||||
|
*** example
|
||||||
|
#+BEGIN_SRc bash
|
||||||
|
sed 's/.*blahblah blah//'
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
- uses regular expressions
|
||||||
|
- way of matching text
|
||||||
|
|
||||||
|
*** sed modifiers
|
||||||
|
- (ab)* - remove zero or more of 'ab'
|
||||||
|
- -E use new replacement
|
||||||
|
- (ab|bc)* - remove 'ab' or 'bc'
|
||||||
|
|
||||||
|
** regex debugger
|
||||||
|
- regex101.com
|
||||||
3
toc.org
3
toc.org
|
|
@ -31,4 +31,5 @@
|
||||||
#+attr_html: :class contents-overview
|
#+attr_html: :class contents-overview
|
||||||
- [[./_subsections/lesson-01.org][Lesson 01 | Course Overview + The Shell]]
|
- [[./_subsections/lesson-01.org][Lesson 01 | Course Overview + The Shell]]
|
||||||
- [[./_subsections/lesson-02.org][Lesson 02 | Shell Tools and Scripting]]
|
- [[./_subsections/lesson-02.org][Lesson 02 | Shell Tools and Scripting]]
|
||||||
|
- [[./_subsections/lesson-03.org][Lesson 03 | Editors (vim)]]
|
||||||
|
- [[./_subsections/lesson-04.org][Lesson 04 | Data Wrangling]]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue