9

Drush 8.1.9 & Drupal 7.53. What I'm looking for is a command like drush ups but without all the modules that are [OK] – so when used with an alias of several sites I don't have to scroll through loads. So all I get is:

aliasname     
Name                               Installed Version  Proposed version  Message          
     Metatag (metatag)                  7.x-1.19           7.x-1.20          Update available 
     Views Slideshow (views_slideshow)  7.x-3.4            7.x-3.5           Update available 

I found drush vset update_check_disabled 1 -y && drush -n -p up – it works but here's a sample output, which is not what I want.

media_ckeditormedia_ckeditormedia_ckeditor
views_slideshowmedia_ckeditor

I also want the version info. Is there anything I can do to get a list of all modules which need an update including the version info?

11

Drush puts that [ok] information out on stderr. So you can actually just dump that by using:

drush ups 2>/dev/null

which for me gave:

 $ drush ups 2>/dev/null
 Name    Installed Version  Proposed version  Message
 Drupal  8.2.5              8.2.6             Update available
1
  • 1
    Love it - works perfectly. Don't understand why but that's fine!
    – iain-g
    Feb 2 '17 at 20:33
5

Consider using 'grep'. It's not exactly a drush-specific command but will get the job done.

drush ups | grep 'Update available'

This command will return all lines that contain the phrase 'Update available'.

4
  • 1
    Yep, this is one way. For the uninitiated - this will pipe the output of drush ups to grep, which will filter by "Update available"
    – Kevin
    Jan 24 '17 at 1:14
  • 1
    Just tried this, but I still see all the 'Checking available updates... [OK]' ones above. What it does do is get rid of the 'Name' 'Installed version' column headings above the ones that need updates, so looks like it works on the results rather than the part where drush is checking each module.
    – iain-g
    Jan 24 '17 at 8:32
  • 1
    yeah, it processes the output from the tool itself. you can also consider custom drush commands. sitepoint.com/drupal-create-drush-command
    – kombogdan
    Jan 24 '17 at 20:33
  • 1
    Thanks - I'll give that a go - might wait till I've learned more drush basics first :)
    – iain-g
    Jan 24 '17 at 22:39
3

In a Drupal 8 project it's better to list updates using composer:

composer outdated 'drupal/*'
2

If your site is built with Composer you can use drush pm:security.

Check Drupal Composer packages for pending security updates.

This uses the Drupal security advisories package to determine if updates are available.

This will give you the following sample output:

+-------------+-------------------+-------------------+
| Name        | Installed Version | Suggested version |
+-------------+-------------------+-------------------+
| drupal/core | 8.6.7             | 8.6.10            |
+-------------+-------------------+-------------------+

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.