Terminal 101
Time 5.8 hrs

Difficulty Intermediate
Prerequisites Teardown & Rebuild (PC)
Departments Human Technologies
Authors Ross Parker
Daniel Roskams
Groupings Individual
Pairs
Threes
Minimum Year Group None

Blurb

Terminal gives us access to the command line interface (CLI), which is a very powerful way to control our computers. In this unit you will learn how to exploit the CLI to get useful things done fast.

License

This work is shared under the following license: Creative Commons BY-SA-NC

Outline

The Pitch
Why should I bother learning this?
  • Want to be the boss of your computer? Learning terminal is the only way to go if you are serious about computing.
Resources
What is needed to run this unit?
  • Laptop (running a variation of *nix, such as Linux, Mac OS, BSD or Unix).
  • Internet access
  • Virtual Box (free, open source)
  • Ubuntu Linux (free, open source)
Interdisciplinary Links
Do not try and force this. What areas of other subjects might this reflect and/discuss language. For IB, links with ToK.
Teacher Reflection
What was successful? What needs changing? Alternative Assessments and Lesson Ideas? What other Differentiation Ideas/Plans could be used?
  • This is a new unit, with the content provided almost exclusively by Daniel Roskams, a student in Year 8.
Credits
Any CC attribution, thanks, credit, etc.
  • Computer Code thumbnail by macrovector on freepik under Freepik License.
  • Text by Daniel Roskams, shared under CC BY

This page requires you to be logged in to access it. Please login and try again.
5 mins
Serious About Computers?
The Pitch
  • Want to be the boss of your computer? Learning terminal is the only way to go if you are serious about computing.
15 mins
Introduction To Terminal
Theory
  • What is it: The terminal is not just a screen with some text on it. It is another way to control your computer.
  • Why is it useful: Once you learn it, it can be quicker than using the mouse because you never have to bother with dragging around lots of windows. Also, it is practically distraction-free.
  • It is not actually as hard as it looks: The commands are just shortened versions of the actual English word, e.g.
    • cp = copy
    • ls = list
    • passwd = password
    • tar = tape archive
  • Basic interaction: You interact with it by typing and then pressing Enter. The command you type will hopefully do something useful.

  • Note of caution: Some commands can do a lot of damage. There is NO TRASH CAN and NO UNDO BUTTON.
  • As a precaution, we will not use Terminal on our main machine: we will install it in a virtual machine.
120 mins
Your Virtual Machine
Getting Set

Mac

  • VirtualBox is a free, open source system for running one operating system in another. Download the Mac version of VirtualBox and install it on your computer.
  • Inside our virtual box, we will run the CLI version of Ubuntu Linux, which is also free and open source. Download Ubuntu Server and save the resulting .iso file on your desktop.
    • Most downloads are done over HTTP, which is OK.
    • But, if you want to get a faster download you can try BitTorrent: if there are lots of people sharing the same file, it will be super quick.
    • If you want to use BitTorrent, try the Transmission client for Mac.
    • Please note, BitTorrent is fine to use for downloading freely shared materials (e.g. open source, Creative Commons, public domain, etc), but it is illegal to use it to share copyrighted materials.
  • The video below might help you in your installation.

Chromebook

  • Installing a Linux VM on a Chromebook is easy
    • It's actually a beta feature of the Chromebook, since Chrome OS is a Linux-based operating system
    • Follow these instructions and set up your Linux terminal on your Chromebook

70 mins
First Commands
Hands On
  • Once you have booted your virtual machine, you should be able to log in, which will leave you at the command prompt, where you can enter commands.
  • For your first command, type echo "Hello World" and then press enter.
  • This command works as follows:

  • Of course, printing random stuff onto the screen is not actually useful, so let's try the following file management commands:
    • cd ~ takes you to your home directory (~ in Linux means home directory, which is where your files live)
    • touch test.txt will make an empty file called test.txt in the directory you are current in (~ in your case).
    • cp test.txt test2.txt will make a copy of test.txt called test2.txt, in the current directory.
    • ls will list the contents of the current directory, so you can see them.
    • mv test2.txt test3.txt will move/rename test2.txt to test3.txt
    • rm test3.txt will delete test3.txt
  • Now try and work out what mkdir and rmdir do.
  • Options to commands: options change the way the command behaves. Try `rm <some useless file>` compared to `rm -v <some useless file>`. The first one does not print out anything, unless the file didn't exist. The second one will print out something like `removed <some useless file>`. Make sure it is actually a useless file, because there is no `trash can` feature. And also, `rm -r <folder>` will delete the folder and ALL its contents.
  • Spend some time now playing with these commands, learning their options, and generally getting used to using the CLI.
20 mins
Short Cuts
Hands On
  • In most CLI environments, the following two shortcuts will save you time:
    • Autocomplete - if you are part the way through typing a command, file or folder name, press the tab key, and the computer will try and autocomplete it for you.
      • For example, type cd ~/Docu and then press tab: it should autocomplete to cd ~/Documents.
    • Command History - by using the up and down arrow keys on your keyboard, you can scroll through commands you have used before, saving you from typing them again.
  • Try these two features until you are comfortable with them.
50 mins
Doing Some Work
Hands On
  • The file system: files on your computer are arranged in folders, which contain the files. The folder that contains all folders (and therefore all files) is the `/` folder (called the root folder). If you typed in `sudo rm -rf /` then your `/Applications` folder would be deleted, followed by everything else, rendering your computer useless. BEWARE!
  • You can actually do work in the terminal. If you type in `cd ~/Documents` then you would change directory to the documents folder. Then you can go `cd Science` to change to the science folder, `touch atoms.txt` to create a file called atoms.txt and then `nano atoms.txt` to open up a frame for editing.
  • Nano is a simple and fast text editor. If you haven't already noticed that it starts up instantly, it does, and also starting Pages/Word takes hundreds of times longer.
  • Spend some time now creating directories for your subjects, and typing up some work using nano.
30 mins
Installing More Apps
Hands On
  • If you want to use other programs, you will need to use a program called apt. APT is a package manager, similar to an "app store". However, you will not need to do any account registration, sign up, etc... because this is a free (both in terms of money (gratis), and in terms of freedom (libre)) service.
  • You can install a web browser like this: sudo apt-get update && sudo apt-get install -y links gpm GPM is a mouse interface for the terminal, so you can use the mouse with links, which is a browser. To access the menus click the mouse on the top line.
    • Syntax of the command: sudo is the program that lets you do powerful things. You will need to type your password. The apt-get update and apt-get install commands update your pkg-db and install programs, respectively.
  • You can search for programs like this: apt-cache search <search term>
Another Approach
Online Learning
  • Another way to learn about using terminal is to use an online tutorial system. One that you might want to try is Code Academy, which has a whole section called Learn the Command Line.
40 mins
Evidence
Finishing Up
  • Spend some time now to create some evidence of what you have learned (video screenshot of you running some commands, and explaining what they do?) and then submit to Gibbon.
Records 1-1 of 1
Unit Students

Sean
Shared on 17/09/2019
Powered by Gibbon v27.0.00dev

Founded by Ross Parker at ICHK Secondary | Built by Ross Parker, Sandra Kuipers and the Gibbon community
Copyright © Gibbon Foundation 2010-2024 | Gibbon™ of Gibbon Education Ltd. (Hong Kong)
Created under the GNU GPL | Credits | Translators | Support