1 - Basic Linux Commands
What are we learning?
Hopefully by the end of this lesson you will be able to:
Install Linux on a Chromebook (basically turn on dev mode)
Update Debian-based linux
Use some basic Linux commands to talk to the Kernel through the BASH shell
The Lesson
What is an Operating System Kernel
"A kernel is a computer program at the core of a computer's operating system that always has complete control over everything in the system."ย (wikipedia)
What is a Terminal or Console
It "... provides a way for the kernel and other processes to send text output to the user, and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor." (wikipedia)
What is a Shell
"... a computer program that exposes an operating system's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation. It is named a shell because it is the outermost layer around the operating system."ย (wikipedia)
So - you use a Shell in a Terminal or Console to communicate with the Kernel.
Technically the colours and "windows" you see in Windows, Mac OS, iOS, Android, etc... are all a "Shell" that allows communication with the Kernel.
The most common shells are BASH and Command Prompt (CMD).
There are many (many) shells available for *nix operating systems. Most are derivatives of SH or BASH.
Turn On Linux in ChromeOS
I would love to have us all install a full Linux distribution but that's not really part of the course. Thankfully ChromeOS is built on top of the Linux kernel (that's right - ChromeOS is another shell).
Grab a class Chromebook (you will be assigned a number)
Login using your school account
Follow the instructions in class to gain access to the Linux features of your Chromebook
Once you are in the terminal (black screen with green text) full screen it with F11
Ask for a list of updates using the Advanced Package Tool (apt):ย sudo apt update
Install the updates using the apt package manager:ย sudo apt -y upgrade
What is that sudo thing?
Some Basic BASH Commands
ls โ list (ls)
mkdir โ make an empty directory (mkdir ICS4U)
cd โ change directory (cd ICS4U)
inside here create a "Unit0" directory and then inside that a "Lesson1" directory
Things to note:
cd ..ย will go back one directory
cd ~ ย will change to your home directory
cd /ย will change to the "root" directory
pwd โ print working directory (what directory are you currently in?)
touch myfirstscript.sh โ create an empty file called myfirstscript.sh
Now create another file called "some_file.txt"
rm โ remove (rm some_file.txt) to delete a file
mv โ move or rename a file (mv myfirstscript.sh hello.sh)ย
echo โ print text or data (echo Hi Mom!)