commit d8d7c9ddfa00c2fe66ebeb1116ad0fefcdaff029 Author: Billy Brawner Date: Mon Jun 20 22:09:40 2016 -0500 Initial commit v0.1.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..16a1311 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2016 William Brawner + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..24a84a9 --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +Interactive Linux/Bash Tutorial +=============================== + +## v0.1.0 + +### What is this? + +The purpose of this tutorial is to teach the basic concepts of Linux and bash to aspiring Linux system administrators. While there are plenty of on-line tutorials that already achieve this, I've set out to create one that would be run from the command line, to integrate learners even more in the environment that they will be working in. This is just a work in progress, so feel free to take it and do what you want with it. + +### How does it work? + +This tutorial goes over several commands and concepts related to bash and linux, before prompting the user to run them and see for themselves how it works. None of the commands are actually run, however, until the user gets the command right. This is a security feature to prevent newbies from accidentally ruining their system. + +### License and Contributing + +I've decided to use the MIT license for this project, because I want this to be freely available to anyone and everyone. So take it, change it, modify it, do what you want with it. Feel free to make a pull request if you want to contribute something to the code as well. I'd be happy to include them :) + +Roadmap +------- + +### v1.0 File system management + * Concepts: + - Basic overview of file system structure + - running commands, using flags & arguments + * Commands: + - ~~ls~~ + - cd + - mv + - cp + - rm + - touch + - mkdir + - pwd + +### v2.0 Reading and editing files + * Concepts: + - pipes + - directing output (overwrite vs append) + * Commands + - vim + - vimtutor + - cat + - tail + - head + - echo + +### v3.0 User and group management + * Concepts: + - Users & Groups + - Permissions + - File attributes + * Commands: + - useradd + - usermod + - groupadd + - chmod + - chown + - lsattr + - chattr + +### v4.0 Managing software + * Concepts: + - Packages + - Package managers + * Commands + - dpkg/rpm + - apt-get/dnf/yum/zypper + +### v5.0 SSH + * Concepts: + - Managing remote systems + - SSH Keys + * Commands + - ssh + - sftp + - scp + - ssh-keygen + +### v6.0 System processes: + * Concepts: + - Processes + - Memory/CPU usage + * Commands: + - ps + - top + - htop + - kill + - killall diff --git a/bash-tutor.sh b/bash-tutor.sh new file mode 100755 index 0000000..d7d44ed --- /dev/null +++ b/bash-tutor.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# First, we'll define some paths to programs that we'll need. This is good +# practice for security and it also arguably keeps the script clean + +LS="/usr/bin/ls --color=auto" + +# Next, we'll simplify the mini-quizzes by wrapping them in a function. The +# idea behind this is to provide a safe environment for the learner to run +# commands in, while still feeling like a bash shell. + +function test_command { + while true; do + read -p "$TUTOR_PROMPT" command + case $command in + "$1") $2; break;; + *) echo "Hmm, that didn't quite look right. Try typing '$1' and pressing Enter" + esac + done +} + +cat <