The Unix command line for Drupal

A lot of the documentation on involves the Unix command line, which can be pretty daunting to a newcomer. This BoF will provide a gentle introduction to the need-to-know Unix commands for working with Drupal. Bring your laptop and join us if you're interested in a hands-on opportunity to learn the basics or if you'd like to help others.

Time slot: 
Site Building


Here is a link to a good basic cheat sheet per our conversation....


Cache Warming can be done on the command line but there are some great resources you should read first. Just search for Cache Warming Drupal in Google.

The BOF group consensus for managing file permissions was to search for the file permissions shell script. Apparently there is a good script on for this already.

The main problem we found with the Drupal permissions explanation and script (mentioned above) was that it assumes a single developer is working with a standard site install (and judging from all the comments there is hardly a consensus on this subject). If you are working on a team with multiple sites (including multi-site instances) giving only the user/owner r/w permissions is quite problematic. The solution we found to work better was to create a webteam group, make this the primary group for each team member, give it r/w and then give 'other' read permissions so that www-data (apache) could access (read) what it needed.
The exception, of course is the files folder/subfolders/files, for which it is important that apache (www-data) remain owner and have r/w access, along with the user(s). [ Each team member is a member of each others group.]
Also, because we do so much work in a virtual host/multi-site environment I had to rewrite the script considerably but it provided a good start.

Remember that the Drupal instance structure and folder/file content is hardly a secret, so letting 'other' have read permissions does not really feel like much of a security issue for us. Custom modules/themes are possibly an exception, and easily worked around.
Comments are welcome. Enjoyed the BOF.

If run from the root of a Drupal install, this grep command searches only .module files within the
modules folder for the text “view site reports.”
Listing 19–14. Command Line Step (in Bold) to Search for “View site reports” Text in Drupal’s core
grep -nHR --include=*.module 'View site reports' modules
'title' => t('View site reports'),

If performance needs to be improved on a complex view, instead of relying on Cache Warming to get past the pain of the first load, Also, consider exporting the complex view to code and implementing that code in a module to improve the given query and speed as needed.

tTanks for the drush help. really gave me some good places to start to play again and get past my fear. Stuff I didn't even think about.


Drush ard is commonly used to create a complete backup of drupal files and db, then Drush arr is used to restore.

Colorado mountains