diff --git a/linux_toolkit_2021/.gitattributes b/linux_toolkit_2021/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..cff6c1caa59cf2de0c306f7bf38cc11acc366de4 --- /dev/null +++ b/linux_toolkit_2021/.gitattributes @@ -0,0 +1,2 @@ +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.mkv filter=lfs diff=lfs merge=lfs -text diff --git a/linux_toolkit_2021/demos/demo1-2021-04-15_23.14.09.mkv b/linux_toolkit_2021/demos/demo1-2021-04-15_23.14.09.mkv new file mode 100644 index 0000000000000000000000000000000000000000..e379b111ce340308ee438f92a31a93067c104ece --- /dev/null +++ b/linux_toolkit_2021/demos/demo1-2021-04-15_23.14.09.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f83c0a2200859dd457ea00458a68d48d2c1f226657d06c77d5953e8e6cadce4c +size 24539 diff --git a/linux_toolkit_2021/demos/demo1-2021-04-15_23.14.09.mkv.mp4 b/linux_toolkit_2021/demos/demo1-2021-04-15_23.14.09.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..1ad522d65ebe8b94f7e288d16f2f066d77c6316c --- /dev/null +++ b/linux_toolkit_2021/demos/demo1-2021-04-15_23.14.09.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bed80d66a94626639d8a2379d3ac84e6f83f6f3fc002dd4433a8147e4324670 +size 24856 diff --git a/linux_toolkit_2021/demos/demo2-2021-04-15_23.12.20.mkv b/linux_toolkit_2021/demos/demo2-2021-04-15_23.12.20.mkv new file mode 100644 index 0000000000000000000000000000000000000000..6dc10986ae19ce1e48e0a515b044bf9bc381ce6e --- /dev/null +++ b/linux_toolkit_2021/demos/demo2-2021-04-15_23.12.20.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0c4405f5082820c0f410469caa1fa3c6b820e4cf8e8395eb764210c7f819fae +size 403297 diff --git a/linux_toolkit_2021/demos/demo2-2021-04-15_23.12.20.mkv.mp4 b/linux_toolkit_2021/demos/demo2-2021-04-15_23.12.20.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..56bad58c8b99ca7159dd92847db848c950c16065 --- /dev/null +++ b/linux_toolkit_2021/demos/demo2-2021-04-15_23.12.20.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:810e7daaeea6daa742232c1e5e589b58bfe42821161cc855e90fdd17ca06122f +size 394048 diff --git a/linux_toolkit_2021/demos/demo2_1-2021-04-15_23.32.44.mkv b/linux_toolkit_2021/demos/demo2_1-2021-04-15_23.32.44.mkv new file mode 100644 index 0000000000000000000000000000000000000000..e29bb1b5b11b77cf05c076dfb77004383163da11 --- /dev/null +++ b/linux_toolkit_2021/demos/demo2_1-2021-04-15_23.32.44.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4200e4dbc62044f54456f148b7691cb397a4d93f483c703a690c4000a9486cdc +size 397920 diff --git a/linux_toolkit_2021/demos/demo2_1-2021-04-15_23.32.44.mkv.mp4 b/linux_toolkit_2021/demos/demo2_1-2021-04-15_23.32.44.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..dbe3b867d63c1b77a95024ffe754b8b086e1d7da --- /dev/null +++ b/linux_toolkit_2021/demos/demo2_1-2021-04-15_23.32.44.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:741ce2b51b9eb5bf2db5aacb1dfd2b3346da330b218f40e310c175643cadb984 +size 382966 diff --git a/linux_toolkit_2021/demos/demo3-2021-04-15_23.14.40.mkv b/linux_toolkit_2021/demos/demo3-2021-04-15_23.14.40.mkv new file mode 100644 index 0000000000000000000000000000000000000000..1f98883bbcbecf48911fc9a7d3502fb950773673 --- /dev/null +++ b/linux_toolkit_2021/demos/demo3-2021-04-15_23.14.40.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a05e15127e3f2c6164e78fa6e0a56196ca8059173393b3fd6f26d9ee9ef579b +size 288228 diff --git a/linux_toolkit_2021/demos/demo3-2021-04-15_23.14.40.mkv.mp4 b/linux_toolkit_2021/demos/demo3-2021-04-15_23.14.40.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..be3788db01baae4438750cd6741ea8cac4b51390 --- /dev/null +++ b/linux_toolkit_2021/demos/demo3-2021-04-15_23.14.40.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd7c5922b64360c62a2c34a40f6182426df0ff3e58fc26a058ec32f1795907b8 +size 266887 diff --git a/linux_toolkit_2021/demos/demo4-2021-04-15_23.27.52.mkv b/linux_toolkit_2021/demos/demo4-2021-04-15_23.27.52.mkv new file mode 100644 index 0000000000000000000000000000000000000000..213f06b0a01cc31aa280416d69494df46d0e0c4f --- /dev/null +++ b/linux_toolkit_2021/demos/demo4-2021-04-15_23.27.52.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a79e800a3a72b72fb736515af7e5a8c7f860a47c892c1387421dcbe1ff2b354 +size 346732 diff --git a/linux_toolkit_2021/demos/demo4-2021-04-15_23.27.52.mkv.mp4 b/linux_toolkit_2021/demos/demo4-2021-04-15_23.27.52.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..c0ea8b744f27cb87d756622d603a3ad845e0b4cc --- /dev/null +++ b/linux_toolkit_2021/demos/demo4-2021-04-15_23.27.52.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db3f9daf2267c2fcb93b7b2255a152b52d6e11876548a17adfb0950a9d46ea53 +size 343671 diff --git a/linux_toolkit_2021/demos/demo5-2021-04-15_23.59.13.mkv b/linux_toolkit_2021/demos/demo5-2021-04-15_23.59.13.mkv new file mode 100644 index 0000000000000000000000000000000000000000..8d684bffa2b773e421acf17d641fe7a84136322f --- /dev/null +++ b/linux_toolkit_2021/demos/demo5-2021-04-15_23.59.13.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2aad3329f0bfb542082acdc365ae88be10983f3d413d4af68321fb934c5a2382 +size 698950 diff --git a/linux_toolkit_2021/demos/demo5-2021-04-15_23.59.13.mkv.mp4 b/linux_toolkit_2021/demos/demo5-2021-04-15_23.59.13.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..87f6a5049fe912a1f0fe62eb87a6ff006ac45de7 --- /dev/null +++ b/linux_toolkit_2021/demos/demo5-2021-04-15_23.59.13.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7774ea40d7e8c881e82d8ab5c9f0374dbe99dd92f097492cb46b0736b6b38170 +size 668129 diff --git a/linux_toolkit_2021/demos/demo6-2021-04-16_00.06.16.mkv b/linux_toolkit_2021/demos/demo6-2021-04-16_00.06.16.mkv new file mode 100644 index 0000000000000000000000000000000000000000..a1de679e27a851dadea85f04b7950bb2ec7ad2e3 --- /dev/null +++ b/linux_toolkit_2021/demos/demo6-2021-04-16_00.06.16.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5da2cc67c83aa337c2233c716c60c6aed27190e3c07e54713e3697e0677631f +size 597890 diff --git a/linux_toolkit_2021/demos/demo6-2021-04-16_00.06.16.mkv.mp4 b/linux_toolkit_2021/demos/demo6-2021-04-16_00.06.16.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..203162c151437f1e70d120c582b4bf6bdc094a57 --- /dev/null +++ b/linux_toolkit_2021/demos/demo6-2021-04-16_00.06.16.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21084280c01634d3ad5d40e4b301ff25828072cccbad725e6cefa459688f8594 +size 518110 diff --git a/linux_toolkit_2021/demos/demo7-2021-04-16_00.18.41.mkv b/linux_toolkit_2021/demos/demo7-2021-04-16_00.18.41.mkv new file mode 100644 index 0000000000000000000000000000000000000000..2e06df138def62849e2dd555202c70fd0ecef51a --- /dev/null +++ b/linux_toolkit_2021/demos/demo7-2021-04-16_00.18.41.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f54da6b57d62aa7efc6a71cec31ac22a665c7e7d7f2e562458f6102b1c154da +size 2000002 diff --git a/linux_toolkit_2021/demos/demo7-2021-04-16_00.18.41.mkv.mp4 b/linux_toolkit_2021/demos/demo7-2021-04-16_00.18.41.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..604bb40d2196cfd11ad85b4f0df5c74d3f98e5c0 --- /dev/null +++ b/linux_toolkit_2021/demos/demo7-2021-04-16_00.18.41.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c10bda8997d863c443fd05c612494204f851f3b6f0632d382703aee5c91c5a52 +size 1747756 diff --git a/linux_toolkit_2021/demos/demo8-2021-04-16_01.29.29.mkv b/linux_toolkit_2021/demos/demo8-2021-04-16_01.29.29.mkv new file mode 100644 index 0000000000000000000000000000000000000000..a1516bcd1745b4d85978ce040882b1ee0990e264 --- /dev/null +++ b/linux_toolkit_2021/demos/demo8-2021-04-16_01.29.29.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:474df5d621df15a4560c6e1f11bc37483ae28de73690bb707756bf6308202b85 +size 665410 diff --git a/linux_toolkit_2021/demos/demo8-2021-04-16_01.29.29.mkv.mp4 b/linux_toolkit_2021/demos/demo8-2021-04-16_01.29.29.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a9a71898c6cc55c90c7b244ca5ab22ade1cdb0ad --- /dev/null +++ b/linux_toolkit_2021/demos/demo8-2021-04-16_01.29.29.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60290b023da6afc35d5c06dfdccecb4c266268109018aec83b34ab3c7a076f33 +size 607520 diff --git a/linux_toolkit_2021/demos/demo9-2021-04-16_01.13.18.mkv b/linux_toolkit_2021/demos/demo9-2021-04-16_01.13.18.mkv new file mode 100644 index 0000000000000000000000000000000000000000..f24d6aeb9567b97bbc349bc880a6c327088f28be --- /dev/null +++ b/linux_toolkit_2021/demos/demo9-2021-04-16_01.13.18.mkv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54b4d091aa0ffd6501dca53f08de085c60ccccc8d907be5e2f9705f231d4380b +size 1497677 diff --git a/linux_toolkit_2021/demos/demo9-2021-04-16_01.13.18.mkv.mp4 b/linux_toolkit_2021/demos/demo9-2021-04-16_01.13.18.mkv.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..d43d945b81f226045f9b7c21901bb476e64226ce --- /dev/null +++ b/linux_toolkit_2021/demos/demo9-2021-04-16_01.13.18.mkv.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e19fd6690469b60ce14b1da33a3b7070515bc05c63d4d2804e6b749b1af4fc2 +size 1374920 diff --git a/linux_toolkit_2021/index.html b/linux_toolkit_2021/index.html index 0e2c734d0c7c7c99b75aafe108003a9f03b91961..05f096494d7ffa900f41505060e17086ac8ec0be 100644 --- a/linux_toolkit_2021/index.html +++ b/linux_toolkit_2021/index.html @@ -111,6 +111,12 @@ Most commands take options that modify their default behavior. --- +# Basics: echo + +<video width="320" height="240" controls> + <source src="demos/demo1-2021-04-15_23.14.09.mkv.mp4" type="video/mp4"> +</video> + # Basics: Taking a Walk List files and show where we are: @@ -129,6 +135,23 @@ cd /home/nils/Desktop cd ~/Desktop ``` +--- + +# Demo + + <video width="320" height="240" controls> + <source src="demos/demo2-2021-04-15_23.12.20.mkv.mp4" type="video/mp4"> +</video> + +--- + +# Basics: Options + + <video width="320" height="240" controls> + <source src="demos/demo3-2021-04-15_23.14.40.mkv.mp4" type="video/mp4"> +</video> + + --- # Bash terminology @@ -167,6 +190,14 @@ Both redirect command output: --- +# Demo + + <video width="320" height="240" controls> + <source src="demos/demo4-2021-04-15_23.27.52.mkv.mp4" type="video/mp4"> +</video> + +--- + # Shell scripts Shell scripts are just textfiles. @@ -196,6 +227,14 @@ If you want, add `alias c='. ~/betterCd.sh'` to the file `~/.bashrc`. --- +# Demo + + <video width="320" height="240" controls> + <source src="demos/demo5-2021-04-15_23.59.13.mkv.mp4" type="video/mp4"> +</video> + +--- + # Bash Summary Bash is a different way of interacting with your system @@ -288,6 +327,14 @@ sleep 300; notify-send "Time is up!" --- +# Demo + + <video width="320" height="240" controls> + <source src="demos/demo6-2021-04-16_00.06.16.mkv.mp4" type="video/mp4"> +</video> + +--- + # Rofi Can be used to display a list of things @@ -308,6 +355,14 @@ See: https://github.com/davatorium/rofi --- +# Demo + + <video width="320" height="240" controls> + <source src="demos/demo7-2021-04-16_00.18.41.mkv.mp4" type="video/mp4"> +</video> + +--- + # xbindkeys A **keydeamon**! Let's us configure keyboard shortcuts. @@ -322,6 +377,11 @@ In file `~/.xbindkeysrc`: control+Mod1+b ``` +Only works when the daemon is running: `xbindkeys` + +Might be useful to add it to the startup file: +`echo xbindkeys >> ~/.xsessionrc` + --- @@ -360,36 +420,45 @@ A command to look for **regular expressions** (commonly just "regex"). Think of regexes as being text patterns on steroids: -`grep -E "^[0-9]" data.csv` prints all the lines starting with a number +`grep -P '^[0-9]' data.csv` prints all the lines starting with a number + +We can put multiple greps together to chain filters! -We can put multiple greps together to chain filters: +--- -TODO +# Demo + + <video width="320" height="240" controls> + <source src="demos/demo8-2021-04-16_01.29.29.mkv.mp4" type="video/mp4"> +</video> -https://www.rexegg.com/ --- #grep -Hot tip: Put `alias grep='grep -E'` into `~/.bashrc`. +Hot tip: Put `alias grep='grep -P'` into `~/.bashrc`. -`-E` switches to "extended regular expressions". +`-P` switches to "extended regular expressions". Unfortunately, there are lots of regex standards with minor differences. Stick with one and don't worry about it (until you do). +https://www.rexegg.com/ + --- #grep -Hot tip: Put `alias grep='grep -E'` into `~/.bashrc`. +Hot tip: Put `alias grep='grep -P'` into `~/.bashrc`. -`-E` switches to "extended regular expressions". +`-P` switches to "extended regular expressions". Unfortunately, there are lots of regex standards with minor differences. Stick with one and don't worry about it (until you do). +https://www.rexegg.com/ + <img src="images/xkcd.png" width="50%"> <p style="color: grey;">https://xkcd.com/1171/</p> @@ -399,12 +468,12 @@ Stick with one and don't worry about it (until you do). The **s**tream **ed**itor. -This tool can search for regular expressions [and more] like we did with `grep`, +This tool can search for regular expressions like we did with `grep` and perform various operations on the matched lines. Example: Delete all comments from a file ```bash -sed -E 's/^#.*//g' file.py +sed -P 's/^#.*//g' file.py ``` --- @@ -427,9 +496,12 @@ find ~/Documents -type f -exec grep -l "//.*TODO" {} \; --- -# file conversion +# File Conversion -Sometimes you want to convert between similar file formats. there are a lot of tools for this. most are specific for some kind of file content.here are some common ones: +Sometimes you want to convert between similar file formats. +There are a lot of tools for this. +Most are specific for some kind of file content. +Here are some common ones: - `ffmpeg` for audio and video - `pandoc` for many hierarchical text formats (mark down, html, latex) @@ -437,10 +509,11 @@ Sometimes you want to convert between similar file formats. there are a lot of t <hr> -Using a bash for-loop, convert all `wav`-files to `mp3`: +Example: I had to convert all demo files from `.mkv` to `.mp4`: ```bash -for file in *.wav; do - ffmpeg -i "$file" "${file%.*}.mp3" +cd demos +for file in *.mkv; do + ffmpeg -i "$file" "${file%.*}.mp4" done ``` @@ -532,14 +605,80 @@ An older but more widely available alternative to tmux is **screen** Automates key presses and mouse movements. Useful for repetitive user interface stuff. -In a browser, copy the link of the current tab and then close it. +In a browser, copy the link of the current tab and then close it: +```bash +xdotool key F6 +sleep 0.2 +xdotool key ctrl+c +sleep 0.2 +xdotool key ctrl+w ``` -"xdotool key --delay 300 F6 ctrl+c ctrl+w" + +Of course you can bind this to a shortcut! +```bash +"xdotool key F6; sleep 0.2; xdotool key ctrl+c; sleep 0.2; xdotool key ctrl+w" F10 ``` --- +# xdotool + +How I made the demos: + +```bash +#!/bin/bash +keypause=200 +commandpause=2 + +xdotool key --clearmodifiers ctrl+l sleep 2 key ctrl+alt+r sleep 2 +while read line +do + xdotool type --delay $keypause "$line" + xdotool key Return + sleep $commandpause +done < $1 +sleep 2 +xdotool key ctrl+alt+r +xdotool type "cd ~/linuxdaysDemo" +xdotool key Return +``` + +--- + +# Demo: xdotool + + <video width="320" height="240" controls> + <source src="demos/demo9-2021-04-16_01.13.18.mkv.mp4" type="video/mp4"> +</video> + + +--- + +# Vim + +The best editor since sliced bread. + +Tree-based undo function with timetravelling! +Composable shortcut keys and modal editing! +Recursive keyboard macros! +Can edit remote files directly via SSH! +Takes weeks to learn! + +--- + +# Vim + +After you have installed Vim, execute `vimtutor`. +This shows you the basics. + +If you want to learn more after that, I recommend the user manual: +Type `:h` in Vim, then press Enter. +You can follow the links in Vim by positioning the cursor over them +and pressing `ctrl+]` + +--- + # Summary <img src="images/categorization.png" width="60%">