Skip to content

The Shell#

Before we do anything, let's make sure you're familiar with the shell and the terminal.

When computers first hit the scenes, we had terminals that were separated from the actual computers that did the number crunshing. The user would key information into the terminal and then send that information over to the mainframe to process it. As the user, you keyed information into a shell via a terminal.

We still do this today, but the two are tightly integrated and the computer you're typing commands into is also the same computer doing the processing as well.

Note

I'm going to be using examples, as I normally do, to explain concepts throughout this chapter. They're going to include commands that I'm not going to explain. That's because with a simple Google query, man <command> lookup or some simple trial and error, you can look up the commands your self - and you should. Learn how-to find information yourself and you'll learn how-to teach yourself anything.

So what are you seeing when you boot up your Ubuntu VM and login?

Ubuntu VM

Ubuntu VM

We have a terminal here that we can use to login to the system. Let's do just that:

Logged into our VM

Logged into our VM

Now we have a shell we can work with. We can send the system commands and it'll return the data/output from those commands. Let's try that: whoami.

I get back this:

Note

I'm going to switch back from screenshots to the command line now, because it's easier to present you with the information.

1
2
michael@develop:~$ whoami
michael

So I used the shell to type a command (whoami) and I got back the output: michael (my username.) This is pretty simple to understand.

The command gave us back "standard output". The term "standard output" means the command "printed" the data it wanted to show to the standard output, which meant it was displayed on our screen. This "standard output" can be referred to as "stdout" in some cases. This stdout can be "redirected" to other places, as we'll see shortly.

When we provide a command with input, that's called "standard input" or stdin. We'll explore these two concepts shortly.

Let's look at the shell environment you're using: Bash.

Key Points#

  1. Bash
  2. Pipelines
  3. Redirects