COMMAND-LINE BASICS

(like REAL basics)

GETTING STARTED WITH THE BASH SHELL

Ok--so here we're going to learn to talk to the computer so that we can get it to do stuff for us.

We do this by typing commands into the "Shell", which will interpret these commands (it's a command-line interpreter) and then send appropriate instructions to the "Kernel" (which you can think of as the very core of the computer--where all the stuff happens). [DON'T follow all of these links--they're just there in case you are desperately curious--try to blitz through this module in 15-20 minutes, DOing everything, but not trying to gain full knowledge about every single word you encounter here!]

There are actually a bunch of shells used by different versions of the Unix operating system, the Thompson Shell, the Bourne Shell, the Z shell . . . there's no real reason to learn too much about all of them at this stage, other than to know that the shell your Mac uses is bash, which stands for "Bourne-Again Shell" (developer humor). So if you find yourself Googling for how to get the current date, try entering "bash current date command" (but don't worry about this now, we'll teach you how to get the date in a sec).

To access the shell on your Mac, you open up the Terminal app, which you can find in your ~/Applications/Utilities folder. You can also hit command + space to open up the spotlight search window and start typing in "Terminal" until you see it appear for you to click.

If you like the way your terminal looks (fonts, colors, etc)--cool. If not, hit command + , and you will be able to change anything you like. On our machines, we usually go for dark backgrounds at 80% opacity, for instance. If it will make you happy to do something crazier, then do it.

You should see a prompt, in the form of a line or box that may be flashing (depending on your preferences). This is where you type commands. Go ahead an type in the command date and hit return. You should see the date and time. Then try the following series of commands out to get a sense of some of the basic commands you'll find yourself using:

VISUAL CHALLENGE

Take a moment to read a couple of the links about the Unix shell and kernel at the top of this section, or any of these other links to see if what they say about the shell and kernel makes sense to you. And you may as well take a look at some images of actual shells and kernels too! Once you've done this, reflect a bit on your current understanding (or "schema" or "mental model") of the shell/kernel relationship in the Unix-based operating system and draw your own visualization of this relationship. Don't spend forever on it, but do something you're happy sharing, then Slack it out to #medium-code!

Peanut Shells and kernels

TAKEAWAYS

Hopefully, you can now