adds a start to the intro to the command line

This commit is contained in:
waldek 2022-02-18 17:01:44 +01:00
parent cbd2cd1f00
commit 6aafc62c71
4 changed files with 66 additions and 1 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
*.swp

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -319,7 +319,7 @@ You can verify the disk's content via the files explorer in gnome.
Now, open a terminal and run the following.
```
waldek@hellodebian:/media/cdrom0$ cd /media/cdrom0/
waldek@hellodebian:~$ cd /media/cdrom0/
waldek@hellodebian:/media/cdrom0$ ls
AUTORUN.INF NT3x TRANS.TBL VBoxLinuxAdditions.run VBoxWindowsAdditions.exe
autorun.sh OS2 VBoxDarwinAdditions.pkg VBoxSolarisAdditions.pkg VBoxWindowsAdditions-x86.exe
@ -348,3 +348,67 @@ Once the machine is rebooted you'll can resize the window and the screen resolut
You can also enable copy/paste and drag and drop between your host and VM now.
![full screen](../assets/VirtualBox_debian_18_02_2022_15_08_01.png)
## Introduction to the command line
We'll be using a few new *words* to reference the command line such as *shell*, *bash* and *terminal* through out the course.
They all pretty much mean the same thing but with some small, and not so important, differences between them.
Essentially a command line is a **textual interface** for humans to operate a computer.
What is very important to understand is that textual command and graphical actions operate on the same computer.
For example, if you create a file via the command line, it will show up in you file explorer and vice versa.
The graphical and textual interfaces are just different *representations* of the same machine.
Now open up a terminal and you'll see the following.
```
waldek@hellodebian:~$
```
This is what we call a [prompt](https://en.wikipedia.org/wiki/Command-line_interface#Command_prompt).
It's not much but it's our *window* into the computer.
As with most things in life you can question it's *who, where, what and when*.
This information is actually **embedded** in the prompt.
Let's break it down.
* `waldek` is **who** I am on this computer
* `hellodebian` is the **what**, as in what computer I'm operating on
* `~` is **where** I am located on this computer
What about the *when* then?
Let's type in `date` and see what happens.
```
waldek@hellodebian:~$ date
Fri 18 Feb 2022 03:46:59 PM CET
waldek@hellodebian:~$
```
There we see our **when**!
But this miniscule operation illustrates us the **fundamental** operation of a command line!
1. we have a prompt where we can run a program
2. the program runs and outputs it's information on the terminal
3. once the program **finishes** we can run an other program
I'm deliberately saying program here but is `date` *really* a program?
It's a bit basic no?
Well, it is a program and most *commands* you'll type into your terminal are actually programs.
We can illustrate this as follows.
```
waldek@hellodebian:~$ vlc
VLC media player 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)
[0000559c46ee95b0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0000559c46f89790] main playlist: playlist is empty
```
Vlc is now running and the terminal is *blocked* meaning we can't run other programs or commands in it.
If you try to run the `date` command again, or `ls` or `htop`, it won't work!
Try it out if you don't believe me.
But what happens if you **close** vlc?
The commands you typed get executed!
This is an illustration of the **sequential** nature of a command line.