How to use Android SDK headless

Latley I had to update the Android SDK of our build server to support android-23. And thought it would be a good idea to record the update process:

$ ${ANDROID_HOME}/tools/android list sdk --all
  ...
  2- Android SDK Platform-tools, revision 23.0.1
  ...
  4- Android SDK Build-tools, revision 23.0.1
  ...
 25- SDK Platform Android 6.0, API 23, revision 1
  ...
 155- Android Support Repository, revision 35
  ...

Update/install some of those packages without UI

$ ${ANDROID_HOME}/tools/android update sdk --no-ui --all --filter 2,4,25,155

Alternatively you can use an alias within the filter statement:

$ ${ANDROID_HOME}/tools/android update sdk --no-ui --all --filter android-23

Ready to build with android-23...