There are a few levels of abstraction involved in presenting what you see in the screenshot you provided. I will attempt to summarize, although this is a rather broad topic.
Terminal Emulator
What you describe:
a window where I can type commands to linux
is not actually bash, at least not by itself. You are looking at a terminal emulator that runs your shell (probably /bin/bash
).
The oft-quoted example of a terminal emulator is xterm
, which is included in virtually all desktop Unix and Linux systems. However, there are many terminal emulators, some of which have substantially more features than xterm
, such as additional mouse controls, tabs (similar to browser tabs), etc.
Linux console (a.k.a. "text mode")
You can also use your Linux machine like a physical terminal, which is what you would see when you boot a Linux/Unix system without a graphical environment (as is the case with many systems configured as servers). Linux still abstracts these somewhat (allowing multiple virtual terminals on one physical computer), but effectively these resemble your monitor being a dedicated "text-only" display.
Shell
The terminal emulator can run any command-line program it likes. By default, it just runs an interactive shell (e.g., bash, sh, csh, ksh, etc.). So, what is a shell?
Quite simply, a shell is a command-line program like any other. If run in interactive mode (i.e., not running a pre-programmed shell script), it presents you with a prompt (usually something like type_outcast:~$
), and then takes whatever you type and interprets it according to its own set of rules (language). Every shell is a bit different, but most of the common shells are broadly similar.
What happens when you type a command?
When you type a command (for example, ls -l
) and pressing Enter, the shell looks at the string you typed and decides what to do. In this case, it looks for a program called ls
in your $PATH
variable, and when it finds it, it runs it in a child process (fork()
and exec()
system calls if you want to know the internals) with the argument you supplied (-l
).
The command's output (known as stdout
or the "standard output", also stderr
or "standard error") are, by default, hooked up to the terminal, so you see the output of your program. Similarly, stdin
("standard input") is hooked up by default as well, so you can type inputs to interactive programs. (Sometimes the program will take more direct control of the terminal, which is an intermediate programming topic.)
Commands' input and output can be redirected, which is another fairly broad topic in itself.
What about all those fancy colors and menus?
Most terminal emulators accept color and various control codes (typically ANSI escape sequences, plus a few more terminal-specific codes). These codes can be used to draw colored interfaces, such as the dialog you see in your screenshot.
In other words, there is no significantly new voodoo here. My system in the early 80s (long before Windows came around) understood ANSI codes and displayed similar dialogs, when my terminal was simply an 80x25 color (EGA) monitor.
So what has changed?
Relatively little has changed since then, except perhaps for the far more widespread prevalence of graphical desktops, which inspired terminal emulator applications, so that people could enjoy larger terminal dimensions as well as have their terminals run alongside their graphical applications, instead of having to dedicate their monitor and keyboard to an 80x25 or 80x43 text-only display.