Terminal

Let's learn about a shell and how it can help us be more productive.

Every operating system comes with some kind of terminal application built in, and they’ll be fine to use for us.

Familiarize yourself with shell

A shell is a terminal in an application that provides a window to run another program, and little else.

A shell is a text-based program, so it doesn’t have a window, and thus needs the terminal to be run on your graphical user interface.

This is how working with computers was done in early times, before there was the idea of a graphical user interface with clickable icons, windows, and a mouse as an input device. Instead, everything was done by typing commands.

While this might take a little while to get used to, you’ll discover why many programmers feel that working with the shell helps them be much more productive and get simple things done quicker than using a mouse and graphical interface.

The default settings for most terminal applications that come built in with operating systems are quite poor, unfortunately. For example, the Terminal.app on Mac OSX opens a tiny window with a very small font. We want to make the window much bigger and find the settings to pick a bigger font size. As programmers, the terminal (along with our editor) is our new home. We want to be as comfortable reading and writing in our terminal as in any other application.

Start typing commands!

Once we’ve started the terminal program, we’ll see our shell’s prompt and can begin entering commands.

The cd command allows us to navigate to a particular directory (where we’ve stored our code), and the ls command lists the contents of a directory.

It’s also important is command-line completion using the “Tab” key:

For example, type cd, space, and the first two or so letters of the directory we want to navigate to, then hit ”Tab.” The shell completes the rest of the directory name for us. If nothing happens, then there are multiple directory names starting with the same few letters. In this case, quickly hit “Tab” twice, and the shell will display a list of choices. Type the next letter and hit “Tab” again.