Create the aliases file

Now, let's create a Drush alias file so that we can more easily interact with our site. Drush alias files should be created in a ".drush" directory in your user directory on your computer. The name of the file should follow the pattern "<site-short-name>.aliases.drushrc.php". For example, I'll create one for this site with the following command:

vi ~/.drush/d8.aliases.drushrc.php

Then, we create an alias for our local site like so:


// local site
$aliases["loc"] = array (
  'uri' => '',
  'root' => '/Websites/Screencasts/drupal8site/web',

Note: Again, we're specifying the "/web" directory as the root

Now, we will be able to use drush commands like drush @d8.loc cr to clear the cache. The alias is comprised of the first part of the file name "d8", followed by a "." (dot), followed by the alias name "loc".