Watch Over My Shoulder
Article
One of the best ways to learn useful tricks at the command line is to sit with someone and watch what they do. Due to the distributed nature of the Drupal community, we don't do nearly enough pair programming. Too often we work in isolation and then push our work on others when we finish. In this article I invite you to sit down beside me and watch over my shoulder as I explore Drupal 8 from the command line.
Navigating Drupal in the Bash Shell
The instructions in this article will work for OSX, and Linux systems, such as Ubuntu, but not Windows.
When reading command line instructions, there are two important characters we need to know about: $
and #
. When applied to the beginning of a line, these refer to the prompt. We don't type these characters when issuing our command. $
signifies the command should be run as a regular user; #
signifies the command is run as the administrative user (“root”).
As a themer, the first thing I want to explore is, of course, the themes. Let's begin by navigating to our Drupal folder. I start by opening up a terminal application. At the command line, I type cd
, and then, using Finder, locate my Drupal folder. I then drag this folder onto the terminal application. It will automatically paste the path to the Drupal folder into my bash prompt. I press return, and bingo – we have navigated to the Drupal folder!
Let's take a peek inside the core folder of themes: we’ll navigate to the folder core/themes and then list (or ls
) all files.
$ cd core/themes
$ ls
There should be four things listed. See them all?