Terminal

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

A terminal is an application that doesn’t do much more but provide a window to run another program, called a “shell”. A shell is a text-based program, so it does not have a window, and thus needs the terminal to be run on your graphical user interface.

A shell is an interactive program that waits for you to type a command and hit enter (or “return”). It will then run the command, display any output, and then, again, sit and wait for you to type the next command.

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 for you to get used to, you’ll discover why many programmers feel that working with the shell helps them be so much more productive and get simple things done so much quicker than using a mouse and a graphical interface.

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

In case you are using Microsoft Windows it is highly recommended to use any kind of unix based terminal. One option is Git-Bash (https://gitforwindows.org/). However, as Ruby and Microsoft Windows are not best friends, it is even better to install the Windows Subsystem for Linux which is available here for Windows 10: https://docs.microsoft.com/en-us/windows/wsl/install-win10. With this option you can install everything you need for your Ruby development under Ubuntu and use Bash as your main shell.

All commands in the following texts are unix commands and will not work in a Microsoft Windows terminal.

Once you have started the terminal program you will see your shell’s prompt, and can start typing commands. You’ll want to learn at least the command cd which allows you to navigate to a particular directory (where you have stored your code), and the command ls which lists the contents of a directory.

Also learn how to use the command line completion using tab: For example, type cd, space, and the first two or so letters of the directory you want to navigate to, then hit tab. The shell will complete the rest of the directory name for you. If nothing happens, then there are multiple directory names starting with the same few letters. In this case hit tab twice, quickly, and your shell will display a list of choices. Type the next letter and hit tab again.