function f-tutorial.0 () { clear cyan ; bold printf "\n\n" echo "Tutorial - A Command Line Introduction" printf "\n\n" white echo "Hit < m > to return to the tutorial menu at any pause - " echo "Hit < x > to get a command prompt." echo echo "In this tutorial, you can move on at your own pace" echo "simply by hitting any other key, unless otherwise prompted." yellow echo echo "If in doubt, I suggest the space bar... most apps use it to page down." echo echo "We'll start now to get you in the habit..." echo "Hit the bar to continue" f-tutescape white echo " " echo "Command tutorials usually start with simple commands." echo " " echo "This one starts with an explanation of directories, because" echo "without understanding how that works, you will be lost - you" echo "need to know where you are in the system before you can usefully" echo "do things. You then learn how to move around in that system." echo " " printf "\n\n" echo "Directories ( also known as \"folders\" ), are shown by a path" echo "written in the form" echo " " echo "/path/to/the/destination/directory" echo " " f-tutescape echo echo "Everything starts from \"/\"" echo " " echo "That needs explaining... " echo " " echo "From \"/\" the contents of the whole inx system is something like.." printf "\n\n" ls -a --color=auto / white ; bold printf "\n\n" echo "this of course tells you nothing if you don't know what you are looking at :-) " echo "Mostly those are directories - subdirectories of / " echo echo echo "Normally when you log in, you land in your \"home\" directory." echo echo "The path from \"/\" to where you currently are looks like:" echo pwd echo echo "So for example /home is directly below \"/\" , and " echo "$HOME is \"inside\" or \"below\" /home " echo echo echo "You can think of this as a root system branching out beneath a tree" echo "... or as a series of boxes within boxes, with \"/\" as the outermost box." echo echo "Hit to see a simple example using the /usr directory" echo " ( Give it a moment to start up - q to quit from the graphic)" f-tutescape fbi /usr/share/graphics/directory-boxes.png clear echo echo "Before moving on to other commands, you find out how to see" echo "what is in the places defined by the directory structure." echo " " echo "In this tutorial, each exercise gives you a command prompt and a new \"shell\"." echo "The command prompt looks something like this ..." echo " " echo "$USER@$HOSTNAME:$PWD $" echo echo echo " ... your home directory has the symbol \" ~ \" (tilde) as a shorthand, so when " echo "in that directory you will not see the full path as shown above." echo echo "Each time you are asked to do an exercise, you exit the shell to come back to this" echo "tutorial. To do that, you can type " echo yellow echo "exit" white echo echo "... followed by the key" echo echo "Commands will be shown here in yellow, as above." printf "\n\n" f-tutescape echo "The command program you will be using is called \"bash\" -" echo "which stands for \"Bourne Again SHell\" because it is based on the earlier" echo "\"Bourne\" shell... you'll see a lot of these kinds of \"jokes\"... don't blame me!" echo echo "Here is a shell (/bin/bash)- try typing" yellow echo echo "pwd" echo white echo "The \"pwd\" command means \"print working directory\"" echo " ... then type " echo yellow echo "exit" white ; unbold echo /bin/bash bold clear echo echo "Welcome back..." echo echo "Let's have a closer look at the directory idea" echo echo "As an example, we could show /home/ like this..." printf "\n\n" yellow cat << EOD /home ___________|_________ | | /home/you (/home/someone-else) ___|____________________________________________________ | | | | | | about-inx example-content intro-text plait screen-notes video EOD white f-tutescape echo echo "Suppose we want to see what is in the \"plait\" directory." echo "To return from anywhere to $HOME, a shortcut is simply to type" echo yellow echo "cd" echo white echo "If we are in our home directory, we can type " echo yellow echo "cd plait" echo white echo "then" echo yellow echo "ls" echo white echo "to see the contents. Try that now, then exit again to return to the tutorial" echo unbold /bin/bash bold echo echo "\"ls\" only gives you the short version - there are many options to ls." f-tutescape echo echo "For example, to see all files in a directory, including \"dot\" files," echo echo "(Dot files are \"hidden\" files by default, starting with a dot -" echo "full stop or period, if you prefer) " echo echo "you can type" echo yellow echo echo "ls -a" echo white echo "Try that now, then exit as usual..." echo echo "Tip: a shortcut for \"exit\" is ctrl+d" unbold echo /bin/bash white bold echo echo "As you saw, different files have colour codes." echo "For example, links to other files are cyan, and directories are blue" f-tutescape echo echo "Let's get a little more adventurous." echo "This time, type " yellow echo echo "cd /usr/local/bin" echo echo "ls" echo echo "exit ( or control+d , as suggested in the previous tip)" echo white unbold /bin/bash echo bold echo "What you saw in the /usr/local/bin directory was the collection" echo "of scripts and shell functions used to run \"INX\" menus etc." echo echo "Of course, you don't actually need to change to a directory " echo "to see it - for instance you could simply have typed" yellow echo echo "ls /usr/local/bin" f-tutescape white echo echo "Now, typing long paths like /usr/lib/foo/bar/flurble gets old fast." echo echo "Fortunately the programmers of the shell agreed, so we have a short cut." echo echo "To complete a path we can hit the tab key. Thus for example" echo yellow echo "cd /us loc bi expands to" white echo echo "cd /usr/local/bin" echo echo "Armed with this knowledge, try navigating to /var/cache/apt/archives," echo "then return to your home directory ( $HOME) by just typing \"cd\"" echo "as explained earlier." echo unbold /bin/bash bold echo echo "OK. Using tab like this is a habit to be encouraged, obviously ;-)" echo echo "Think of moving from one directory to another as if you were" echo "actually moving from place to place. At any time, you are in " echo "whatever directory is returned by the \"pwd\" command - or, more simply," echo "the path shown by the default prompt." f-tutescape echo echo "The more observant user will have noticed something extra in the inx prompt..." echo echo "Because this is a \"console only\" system, it is nice to know which virtual" echo "terminal you are currently using. ( tty1, tty2 and so on )." f-tutescape echo echo "Now, because at any given moment you can only see the terminal" echo "that you are looking at, you might not be aware that there are" echo "six altogether - and you can easily move from one to another..." echo echo "I will now show you your six vt virtual terminals ( tty1-tty6 )" echo echo echo "This will only take a few seconds and it doesn't " echo "hurt a bit... Hit to see ... " read -s -n 1 for tty in $(seq 1 6) ; do chvt $tty && sleep 2 ; done ; chvt $(tty | cut -c 9) clear cyan echo echo "So - I have set up some menus and stuff on each tty for you." echo "You can always customise to your taste, of course - each menu has an escape key..." echo echo white echo "Try navigating through the tty numbers - " echo yellow echo "alt + arrow keys or alt + F1-6" echo white echo echo green echo "It might be an idea to end up here on $(tty) when you have finished..." white f-tutescape echo printf "\n\n\n" cat << EOC So now you have an idea of how to navigate the file system structure, and how to switch between "workspaces" by using virtual terminals. That's already more than a lot of users know ! A few commands coming up, in tutorial 1 - choose it from the menu. EOC echo echo f-tutescape f-tutorial }