Drush: Command Line Utility for Drupal on FreeBSD

Drush Logo

About Drush:

Drush is a command line shell and Unix scripting interface for Drupal installations.  It can update Drupal’s core files, update modules and execute sql queries just to name a few.  It is a must have utility to manage one or many Drupal installations.  This guide will only touch on a few of the many commands.

Install Drush:

# portsnap fetch update
# cd /usr/ports/www/drush
# make install clean

 

Navigate to your Drupal Folder:

# cd /usr/local/www/drupal7

 

Status Command:

Let’s start by using the status command:

# drush status
Drupal version                  :  7.53                       
Site URI                        :  http://default             
Database driver                 :  mysql                      
Database hostname               :  localhost                  
Database port                   :                             
Database username               :  root                       
Database name                   :  Drupal                     
Database                        :  Connected                  
Drupal bootstrap                :  Successful                 
Drupal user                     :                             
Default theme                   :  crppa                      
Administration theme            :  seven                      
PHP configuration               :  /usr/local/etc/php.ini     
PHP OS                          :  FreeBSD                    
Drush script                    :  /usr/local/bin/drush.phar  
Drush version                   :  8.1.7                      
Drush temp directory            :  /tmp                       
Drush configuration             :                             
Drush alias files               :                             
Install profile                 :  standard                   
Drupal root                     :  /usr/local/www/drupal7     
Drupal Settings File            :  sites/default/settings.php 
Site path                       :  sites/default              
File directory path             :  sites/default/files        
Private file directory path     :  /usr/local/www/private     
Temporary file directory path   :  /usr/local/www/tmp

 

Update Commands:

Check available updates to the core and contrib projects:

# drush pm-updatestatus
Checking available update data ... [ok]
Checking available update data for Drupal. [ok]
Checking available update data for Advanced Forum (advanced_forum). [ok]
Checking available update data for Chaos tools (ctools). [ok]
Checking available update data for CAPTCHA (captcha). [ok]
Checking available update data for Printer-friendly pages (print). [ok]
Checking available update data for Private files download permission [ok]
(private_files_download_permission).
Checking available update data for Secure Login (securelogin). [ok]
Checking available update data for Security Review (security_review). [ok]
Checking available update data for SMTP Authentication Support (smtp).[ok]
Checking available update data for Touch icons (touch_icons). [ok]
Checking available update data for User Search to People [ok]
Administration (usersearchtoadmin).
Checking available update data for Video.js (videojs). [ok]
Checking available update data for Views (views). [ok]
Checking available update data for Wysiwyg (wysiwyg).

 

Update Drupal’s core and contrib projects run the following command:

# drush pm-updatecode

Update Drupal’s database tables run either the update.php script in the browser or use the following command:

# drush updatedb

Update Drupal’s core and contrib projects, and apply any pending database updates run the following command:

# drush pm-update

 

Download and Install Commands:

Download and enable a module use the following commands:

# drush pm-download views(module name)
# drush pm-enable views(module name)

Disable or uninstall a module use the following commands:

# drush pm-disable views(module name)
# drush pm-uninstall views(module name)

 

Cache, List, and Help Commands:

Clear cache files using the following command:

# drush cache-clear

Enter a number to choose which cache to clear.
[0]   :  Cancel         
[1]   :  drush          
[2]   :  all            
[3]   :  theme-registry 
[4]   :  menu           
[5]   :  css-js         
[6]   :  block          
[7]   :  module-list    
[8]   :  theme-list     
[9]   :  registry       
[10]  :  views

Clear all cache files choose option [2] above or run the following command:

# drush cache-clear all

List all available modules and themes, and show detailed information for one or more extensions run the following commands:

# drush pm-list
# drush pm-info

Help is just one command away!

# drush help

References:

drush.org

Drush Commands

Leave a Reply

Your email address will not be published.