From 7f1ff049e234a7e51a9f1270a01539420df09f9d Mon Sep 17 00:00:00 2001 From: waldek Date: Tue, 17 May 2022 10:25:50 +0200 Subject: [PATCH] first general restructure with proper toc --- .../learning_bash_scripting.md | 0 advanced/readme.md | 0 generate_toc.py | 44 ++++ outline.md | 3 + readme.md | 244 +++++++++--------- 5 files changed, 162 insertions(+), 129 deletions(-) rename CCNA/readme.md => advanced/learning_bash_scripting.md (100%) create mode 100644 advanced/readme.md create mode 100644 generate_toc.py create mode 100644 outline.md diff --git a/CCNA/readme.md b/advanced/learning_bash_scripting.md similarity index 100% rename from CCNA/readme.md rename to advanced/learning_bash_scripting.md diff --git a/advanced/readme.md b/advanced/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/generate_toc.py b/generate_toc.py new file mode 100644 index 0000000..dd5ccef --- /dev/null +++ b/generate_toc.py @@ -0,0 +1,44 @@ +import subprocess + + +LINK = "https://github.com/ekalinin/github-markdown-toc" +OUTPUT = "readme.md" +OUTLINE = "outline.md" +INPUT = [ + "essential/introduction_to_linux.md", + "essential/introduction_to_the_commandline.md", + "essential/introduction_to_administration.md", + "advanced/learning_bash_scripting.md" + ] +CMD = "gh-md-toc" +FILTER = "(#" +TITLE = "Table of Contents" + + +if __name__ == "__main__": + try: + p = subprocess.Popen([CMD], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output, err = p.communicate() + except Exception as e: + print("please install {}".format(LINK)) + exit() + CONTENT = [] + for f in INPUT: + p = subprocess.Popen([CMD, f], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output, err = p.communicate() + output = output.decode().split("\n") + for line in output: + if FILTER in line: + line = line.replace(FILTER, "(./{}#".format(f)) + if TITLE in line: + title = " ".join(f.replace(".md", "").split("_")).capitalize() + title = title.replace("/", ": ") + line = title + CONTENT.append(line) + p = subprocess.Popen(["cp", OUTLINE, OUTPUT], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p.wait() + print("writing") + with open(OUTPUT, "a") as fp: + for line in CONTENT: + fp.write("{}\n".format(line)) + print("done...") diff --git a/outline.md b/outline.md new file mode 100644 index 0000000..d2b4c03 --- /dev/null +++ b/outline.md @@ -0,0 +1,3 @@ +# Hello world + +Welcome! diff --git a/readme.md b/readme.md index ee1b2f3..3f129f5 100644 --- a/readme.md +++ b/readme.md @@ -1,146 +1,132 @@ -# About +# Hello world -Table of Contents +Welcome! + +Essential: introduction to linux ================= -* [Introduction to Linux](./essential/readme.md#introduction-to-linux) - * [Where does Linux originate from?](./essential/readme.md#where-does-linux-originate-from) - * [Who is behind this project?](./essential/readme.md#who-is-behind-this-project) - * [What is the deal with 'GNU-slash-Linux'?](./essential/readme.md#what-is-the-deal-with-gnu-slash-linux) - * [Where can you get some Linux?](./essential/readme.md#where-can-you-get-some-linux) - * [Debian](./essential/readme.md#debian) -* [How to create a virtual machine](./essential/readme.md#how-to-create-a-virtual-machine) -* [Breakdown of the Debian installation](./essential/readme.md#breakdown-of-the-debian-installation) -* [Exercise](./essential/readme.md#exercise) -* [Quick look at an idle system](./essential/readme.md#quick-look-at-an-idle-system) -* [Package managers](./essential/readme.md#package-managers) - * [Graphical installation](./essential/readme.md#graphical-installation) - * [Command line installation](./essential/readme.md#command-line-installation) - * [Adding a secondary desktop environment](./essential/readme.md#adding-a-secondary-desktop-environment) -* [Changing the runlevel](./essential/readme.md#changing-the-runlevel) -* [Exercise](./essential/readme.md#exercise-1) -* [Guest additions](./essential/readme.md#guest-additions) -* [Introduction to the command line](./essential/readme.md#introduction-to-the-command-line) - * [Compiled vs interpreted](./essential/readme.md#compiled-vs-interpreted) - * [Note on file extensions](./essential/readme.md#note-on-file-extensions) -* [More about paths](./essential/readme.md#more-about-paths) - * [Absolute and relative paths](./essential/readme.md#absolute-and-relative-paths) - * [root and / and /root are not the same thing](./essential/readme.md#root-and---and-root-are-not-the-same-thing) -* [Exercise](./essential/readme.md#exercise-2) -* [A pit stop to review what we've learned so far](./essential/readme.md#a-pit-stop-to-review-what-weve-learned-so-far) -* [Arguments and flags](./essential/readme.md#arguments-and-flags) -* [Getting help](./essential/readme.md#getting-help) - * [Options](./essential/readme.md#options) - * [Manuals](./essential/readme.md#manuals) -* [Exercise](./essential/readme.md#exercise-3) -* [Creating, modifying and deleting](./essential/readme.md#creating-modifying-and-deleting) - * [Directories](./essential/readme.md#directories) - * [Files](./essential/readme.md#files) - * [nano](./essential/readme.md#nano) - * [vi and vim](./essential/readme.md#vi-and-vim) -* [Exercise](./essential/readme.md#exercise-4) -* [Finding stuff](./essential/readme.md#finding-stuff) - * [Finding files](./essential/readme.md#finding-files) - * [Searching inside files](./essential/readme.md#searching-inside-files) - * [Wildcards and regular expressions](./essential/readme.md#wildcards-and-regular-expressions) -* [Pipes and redirects](./essential/readme.md#pipes-and-redirects) -* [Users](./essential/readme.md#users) - * [Adding and removing users](./essential/readme.md#adding-and-removing-users) - * [Switching user](./essential/readme.md#switching-user) -* [Permissions](./essential/readme.md#permissions) - * [Octal number system](./essential/readme.md#octal-number-system) - * [Changing permissions](./essential/readme.md#changing-permissions) - * [Changing ownership](./essential/readme.md#changing-ownership) -* [Remote control of a server](./essential/readme.md#remote-control-of-a-server) - * [History](./essential/readme.md#history) - * [SSH and SFTP](./essential/readme.md#ssh-and-sftp) -* [Bandit](./essential/readme.md#bandit) +* [Introduction to Linux](./essential/introduction_to_linux.md#introduction-to-linux) + * [Where does Linux originate from?](./essential/introduction_to_linux.md#where-does-linux-originate-from) + * [Who is behind this project?](./essential/introduction_to_linux.md#who-is-behind-this-project) + * [What is the deal with 'GNU-slash-Linux'?](./essential/introduction_to_linux.md#what-is-the-deal-with-gnu-slash-linux) + * [Where can you get some Linux?](./essential/introduction_to_linux.md#where-can-you-get-some-linux) + * [Debian](./essential/introduction_to_linux.md#debian) +* [How to create a virtual machine](./essential/introduction_to_linux.md#how-to-create-a-virtual-machine) +* [Breakdown of the Debian installation](./essential/introduction_to_linux.md#breakdown-of-the-debian-installation) +* [Exercise](./essential/introduction_to_linux.md#exercise) +* [Quick look at an idle system](./essential/introduction_to_linux.md#quick-look-at-an-idle-system) +* [Package managers](./essential/introduction_to_linux.md#package-managers) + * [Graphical installation](./essential/introduction_to_linux.md#graphical-installation) + * [Command line installation](./essential/introduction_to_linux.md#command-line-installation) + * [Adding a secondary desktop environment](./essential/introduction_to_linux.md#adding-a-secondary-desktop-environment) +* [Changing the runlevel](./essential/introduction_to_linux.md#changing-the-runlevel) +* [Exercise](./essential/introduction_to_linux.md#exercise-1) +* [Guest additions](./essential/introduction_to_linux.md#guest-additions) -# Planning + -## Essential -### Day 1 +Essential: introduction to the commandline +================= -* [Introduction to Linux](./essential/readme.md#introduction-to-linux) - * [Where does Linux originate from?](./essential/readme.md#where-does-linux-originate-from) - * [Who is behind this project?](./essential/readme.md#who-is-behind-this-project) - * [What is the deal with 'GNU-slash-Linux'?](./essential/readme.md#what-is-the-deal-with-gnu-slash-linux) - * [Where can you get some Linux?](./essential/readme.md#where-can-you-get-some-linux) - * [Debian](./essential/readme.md#debian) -* [How to create a virtual machine](./essential/readme.md#how-to-create-a-virtual-machine) -* [Breakdown of the Debian installation](./essential/readme.md#breakdown-of-the-debian-installation) -* [Exercise](./essential/readme.md#exercise) -* [Quick look at an idle system](./essential/readme.md#quick-look-at-an-idle-system) -* [Package managers](./essential/readme.md#package-managers) - * [Graphical installation](./essential/readme.md#graphical-installation) - * [Command line installation](./essential/readme.md#command-line-installation) - * [Adding a secondary desktop environment](./essential/readme.md#adding-a-secondary-desktop-environment) -* [Changing the runlevel](./essential/readme.md#changing-the-runlevel) -* [Exercise](./essential/readme.md#exercise-1) +* [Introduction to the command line](./essential/introduction_to_the_commandline.md#introduction-to-the-command-line) + * [Compiled vs interpreted](./essential/introduction_to_the_commandline.md#compiled-vs-interpreted) + * [Note on file extensions](./essential/introduction_to_the_commandline.md#note-on-file-extensions) +* [More about paths](./essential/introduction_to_the_commandline.md#more-about-paths) + * [Absolute and relative paths](./essential/introduction_to_the_commandline.md#absolute-and-relative-paths) + * [root and / and /root are not the same thing](./essential/introduction_to_the_commandline.md#root-and---and-root-are-not-the-same-thing) +* [Exercise](./essential/introduction_to_the_commandline.md#exercise) +* [A pit stop to review what we've learned so far](./essential/introduction_to_the_commandline.md#a-pit-stop-to-review-what-weve-learned-so-far) +* [Arguments and flags](./essential/introduction_to_the_commandline.md#arguments-and-flags) +* [Getting help](./essential/introduction_to_the_commandline.md#getting-help) + * [Options](./essential/introduction_to_the_commandline.md#options) + * [Manuals](./essential/introduction_to_the_commandline.md#manuals) + * [Exercise](./essential/introduction_to_the_commandline.md#exercise-1) +* [Creating, modifying and deleting](./essential/introduction_to_the_commandline.md#creating-modifying-and-deleting) + * [Directories](./essential/introduction_to_the_commandline.md#directories) + * [Files](./essential/introduction_to_the_commandline.md#files) + * [Links](./essential/introduction_to_the_commandline.md#links) +* [Editors](./essential/introduction_to_the_commandline.md#editors) + * [nano](./essential/introduction_to_the_commandline.md#nano) + * [Exercise](./essential/introduction_to_the_commandline.md#exercise-2) + * [vi and vim](./essential/introduction_to_the_commandline.md#vi-and-vim) + * [Exercise](./essential/introduction_to_the_commandline.md#exercise-3) +* [Opening or peaking into files](./essential/introduction_to_the_commandline.md#opening-or-peaking-into-files) +* [Exercise](./essential/introduction_to_the_commandline.md#exercise-4) +* [Finding stuff](./essential/introduction_to_the_commandline.md#finding-stuff) + * [Finding files](./essential/introduction_to_the_commandline.md#finding-files) + * [The easy way](./essential/introduction_to_the_commandline.md#the-easy-way) + * [The hard way](./essential/introduction_to_the_commandline.md#the-hard-way) +* [Exercise](./essential/introduction_to_the_commandline.md#exercise-5) +* [Searching inside files](./essential/introduction_to_the_commandline.md#searching-inside-files) + * [Wildcards and regular expressions](./essential/introduction_to_the_commandline.md#wildcards-and-regular-expressions) + * [Wildcards](./essential/introduction_to_the_commandline.md#wildcards) +* [Exercise](./essential/introduction_to_the_commandline.md#exercise-6) +* [Exercise](./essential/introduction_to_the_commandline.md#exercise-7) + * [Regular expressions](./essential/introduction_to_the_commandline.md#regular-expressions) +* [Pipes and redirects](./essential/introduction_to_the_commandline.md#pipes-and-redirects) + * [Redirecting](./essential/introduction_to_the_commandline.md#redirecting) + * [Piping](./essential/introduction_to_the_commandline.md#piping) +* [Text manipulation](./essential/introduction_to_the_commandline.md#text-manipulation) +* [Ideas](./essential/introduction_to_the_commandline.md#ideas) -### Day 2 + -* [Guest additions](./essential/readme.md#guest-additions) -* [Introduction to the command line](./essential/readme.md#introduction-to-the-command-line) - * [Compiled vs interpreted](./essential/readme.md#compiled-vs-interpreted) - * [Note on file extensions](./essential/readme.md#note-on-file-extensions) -* [More about paths](./essential/readme.md#more-about-paths) - * [Absolute and relative paths](./essential/readme.md#absolute-and-relative-paths) - * [root and / and /root are not the same thing](./essential/readme.md#root-and---and-root-are-not-the-same-thing) -* [Exercise](./essential/readme.md#exercise-2) -* [A pit stop to review what we've learned so far](./essential/readme.md#a-pit-stop-to-review-what-weve-learned-so-far) -* [Arguments and flags](./essential/readme.md#arguments-and-flags) -* [Getting help](./essential/readme.md#getting-help) - * [Options](./essential/readme.md#options) - * [Manuals](./essential/readme.md#manuals) -* [Exercise](./essential/readme.md#exercise-3) -* [Creating, modifying and deleting](./essential/readme.md#creating-modifying-and-deleting) - * [Directories](./essential/readme.md#directories) - * [Files](./essential/readme.md#files) - * [nano](./essential/readme.md#nano) - * [vi and vim](./essential/readme.md#vi-and-vim) -* [Exercise](./essential/readme.md#exercise-4) -### Day 3 +Essential: introduction to administration +================= -* [Finding stuff](./essential/readme.md#finding-stuff) - * [Finding files](./essential/readme.md#finding-files) - * [Searching inside files](./essential/readme.md#searching-inside-files) - * [Wildcards and regular expressions](./essential/readme.md#wildcards-and-regular-expressions) -* [Pipes and redirects](./essential/readme.md#pipes-and-redirects) -* [Users](./essential/readme.md#users) - * [Adding and removing users](./essential/readme.md#adding-and-removing-users) - * [Switching user](./essential/readme.md#switching-user) -* [Permissions](./essential/readme.md#permissions) - * [Octal number system](./essential/readme.md#octal-number-system) - * [Changing permissions](./essential/readme.md#changing-permissions) - * [Changing ownership](./essential/readme.md#changing-ownership) -* [Remote control of a server](./essential/readme.md#remote-control-of-a-server) - * [History](./essential/readme.md#history) - * [SSH and SFTP](./essential/readme.md#ssh-and-sftp) +* [Users](./essential/introduction_to_administration.md#users) + * [Adding and removing users](./essential/introduction_to_administration.md#adding-and-removing-users) + * [GNOME](./essential/introduction_to_administration.md#gnome) + * [command line](./essential/introduction_to_administration.md#command-line) + * [Switching user](./essential/introduction_to_administration.md#switching-user) + * [Groups](./essential/introduction_to_administration.md#groups) +* [Permissions](./essential/introduction_to_administration.md#permissions) + * [Octal number system](./essential/introduction_to_administration.md#octal-number-system) + * [Changing ownership](./essential/introduction_to_administration.md#changing-ownership) + * [umask](./essential/introduction_to_administration.md#umask) + * [Essential programs](./essential/introduction_to_administration.md#essential-programs) +* [Remote control of a server](./essential/introduction_to_administration.md#remote-control-of-a-server) + * [History](./essential/introduction_to_administration.md#history) + * [SSH and SFTP](./essential/introduction_to_administration.md#ssh-and-sftp) +* [Bandit](./essential/introduction_to_administration.md#bandit) -### Day 4 + -* [Bandit](./essential/readme.md#bandit) -### Day 5 +Advanced: learning bash scripting +================= -* [Bandit](./essential/readme.md#bandit) -* [Moving forward](./essential/readme.md#moving-forward) +* [bash](./advanced/learning_bash_scripting.md#bash) +* [Using variables to store the output of command](./advanced/learning_bash_scripting.md#using-variables-to-store-the-output-of-command) +* [Coding challenge - Output system stats](./advanced/learning_bash_scripting.md#coding-challenge---output-system-stats) +* [Getting input into the script](./advanced/learning_bash_scripting.md#getting-input-into-the-script) + * [With read](./advanced/learning_bash_scripting.md#with-read) +* [Coding challenge - Secret input](./advanced/learning_bash_scripting.md#coding-challenge---secret-input) + * [read multiple variables](./advanced/learning_bash_scripting.md#read-multiple-variables) + * [With command line arguments](./advanced/learning_bash_scripting.md#with-command-line-arguments) + * [From a file](./advanced/learning_bash_scripting.md#from-a-file) + * [From a pipe](./advanced/learning_bash_scripting.md#from-a-pipe) +* [Coding Challenge - output the exact output below](./advanced/learning_bash_scripting.md#coding-challenge---output-the-exact-output-below) +* [More math!](./advanced/learning_bash_scripting.md#more-math) + * [The let keyword](./advanced/learning_bash_scripting.md#the-let-keyword) + * [The expr keyword](./advanced/learning_bash_scripting.md#the-expr-keyword) + * [Double parenthesis](./advanced/learning_bash_scripting.md#double-parenthesis) + * [Variable length](./advanced/learning_bash_scripting.md#variable-length) +* [If Statements - How to make decisions within your Bash script.](./advanced/learning_bash_scripting.md#if-statements---how-to-make-decisions-within-your-bash-script) + * [How does it work behind the scenes?](./advanced/learning_bash_scripting.md#how-does-it-work-behind-the-scenes) + * [Nested if statements](./advanced/learning_bash_scripting.md#nested-if-statements) +* [Coding challenge - File information](./advanced/learning_bash_scripting.md#coding-challenge---file-information) + * [A modern version of test](./advanced/learning_bash_scripting.md#a-modern-version-of-test) + * [[[ ]]](./advanced/learning_bash_scripting.md#--) + * [(( ))](./advanced/learning_bash_scripting.md#---1) + * [&& and ||](./advanced/learning_bash_scripting.md#-and--) +* [Loops - A variety of ways to perform repetitive tasks.](./advanced/learning_bash_scripting.md#loops---a-variety-of-ways-to-perform-repetitive-tasks) +* [Functions - Reuse code to make life easier.](./advanced/learning_bash_scripting.md#functions---reuse-code-to-make-life-easier) +* [User Interface - Make your scripts user friendly.](./advanced/learning_bash_scripting.md#user-interface---make-your-scripts-user-friendly) + * [Python](./advanced/learning_bash_scripting.md#python) + * [Vim as an IDE](./advanced/learning_bash_scripting.md#vim-as-an-ide) -## CCNA - -### Day 1 - 5 - -* Idem as [essential](#essential) - -### Day 6 - 8 - -* Networking on Debian - -### Day 9 - 10 - -* bash scripting -* vim customization +