[Drush] How to create create drush aliases

| | 1 min read

Drush alias are much handy when it comes to running commands in your local and executing them in server. Setting up alias needs little configuration. Read on to know the configurations.

You would need to create alias file and put them in .drush folder of your home directory to make it available from anywhere. Drush alias file could be named as per the following naming convention.


Each file can contain any number of aliases in a multi dimensional array, the key of each is the sub item for that alias. Have a look at the example as listed below.

 $aliases['dev'] = array(
  'root' => '/home/user/public_html/mysite',
  'ac-site' => 'sitename',
  'ac-env' => 'dev',
  'uri' => 'dev.example.com',
  'remote-host' => 'example.com',
  'remote-user' => 'user-1',

You can use the following command for synchronizing the files to your local site.

 drush rsync @sitename.dev:sites/default/files/ sites/default/files/. 

Hope this helps.