![](https://csdnimg.cn/release/download_crawler_static/9847340/bg11.jpg)
CHAPTER 2 ■ INSTALLATION AND CONFIGURATION
12
OK, so it might not look that impressive right now, but trust me, in a short while, when we come to configuring
the terminal, you’ll see we’ll be making fundamental improvements that add lots of useful features to the shell.
Note ■ in the top right corner of the terminal you’ll see some text coloured red, which is the version number of the
Ruby programming language available (at that moment) to the terminal. The Ruby version is acquired and inserted by our
custom configuration (Listing 2-1), which we’ll look at shortly.
Shell Commands
Throughout this book, I’ll be using shell commands to do such things as creating files and folders, changing
directories, cloning Git repositories, downloading files, etc. I do this so it limits the need to move between the terminal
and your operating system’s GUI.
Note ■ Anytime I tell you to “run a command,” it is implied that I mean to either type the command (or copy and paste it)
into your terminal and press the carriage return/Enter key to run the command.
You should be fine to just run the commands as and when I instruct you to do so. Although I’ll explain each and
every command I ask you to run, if you’re interested to know more about the command and the options available, you
can view the relevant documentation for a command either online or within the operating system’s built-in manual.
To access the shell manual, you have to run the following command from your terminal (remember to substitute
{command} for the actual command):
man {command}
For example, imagine I tell you to run the following command:
ls -la | grep vimrc
In the preceding example, what we have are two commands separated by a pipe |. ls is the first command, and
-la are the options. The result of the ls command is then passed over to the grep command, where we also pass in
vimrc as an argument to the grep command.
Again, you should be fine just running the commands as and when I instruct. But it can be helpful to understand
how to read shell commands and where to find help.
To understand the preceding command, you’ll have to learn to break it down into its component parts (the
individual commands and options/flags). Commands can be constructed from multiple other commands (much like
connecting bits of Lego pieces together). Whenever you see the pipe character |, that is effectively telling us that we’re
passing the result of the command to the left of it as input for the command to the right of it.
If we consider the preceding command ls –la | grep vimrc, we can see that this command is made up of two
sub-commands. The first part of the command is ls –la, and the second part of the command is the grep vimrc part.
Commands are typically made up of the command itself (in this case, the commands are ls and grep), followed
by optional “flags” and then a parameter (or multiple parameters). In the preceding example, only the ls command
has specified some flags to alter the behavior of the command. You can tell when a flag is provided, because it is
prefixed by a hyphen (–). Here, we’ve passed in two flags, –l and –a, but we’ve used a shorthand version, –la, which
combines both flags into one, to save on space. In this case, providing an argument to the ls command is optional
(the command by default will list any files in the current, or specified, directory) The flags provided to the ls
command determine how the results are displayed.