Controlling moodle from the command line when you can't login
Sometimes you can't login to moodle because a plugin or other dependency has broken it.
Install Moosh.
sudo apt-add-repository 'deb http://ppa.launchpad.net/zabuch/ppa/ubuntu trusty main'
sudo apt-get update
sudo apt-get install moosh
The command Moosh understands the following sub-commands:
activity-add
activity-config-set
activity-delete
activity-move
admin-login
admin-remove-orphaned-modules
apache-parse-extendedlog
apache-parse-missing-files
apache-parse-perflog
audit-passwords
auth-list
auth-manage
backup-info
badge-delete
base-path
block-add
block-manage
cache-add-redis-store
cache-clear
cache-config-get
cache-course-rebuild
cache-edit-mappings
cache-test
category-config-set
category-create
category-delete
category-export
category-import
category-list
category-move
category-resortcourses
chkdatadir
code-check
cohort-create
cohort-enrol
cohort-enrolfile
cohort-unenrol
config-get
config-plugin-export
config-plugin-import
config-plugins
config-set
course-backup
course-cleanup
course-config-set
course-create
course-delete
course-enableselfenrol
course-enrol
course-enrolbyname
course-info
course-list
course-reset
course-restore
course-unenrol
data-stats
db-stats
debug-off
debug-on
delete-missingplugins
dev-langusage
dev-versionbump
download-moodle
event-fire
event-list
file-check
file-datacheck
file-dbcheck
file-delete
file-hash-delete
file-list
file-path
file-upload
filter-set
fontawesome-refreshcache
form-add
forum-newdiscussion
framework-import
generate-availability
generate-block
generate-cfg
generate-enrol
generate-filemanager
generate-form
generate-gradeexport
generate-gradereport
generate-lang
generate-local
generate-messageoutput
generate-module
generate-moosh
generate-qtype
generate-userprofilefield
generate-ws
gradebook-export
gradebook-import
gradecategory-create
gradecategory-list
gradeitem-create
gradeitem-list
group-assigngrouping
group-create
group-delete
group-list
group-memberadd
grouping-create
info
info-context
info-plugins
lang-compare
languages-update
maintenance-off
maintenance-on
module-config
module-copy
module-manage
module-reinstall
nagios-check
nginx-parse-extendedlog
perf-analyse
php-eval
plugin-download
plugin-install
plugin-list
plugin-uninstall
plugins-usage
question-import
questioncategory-create
quiz-delete-attempts
random-label
report-concurrency
restore-settings
role-create
role-delete
role-list
role-reset
role-update-capability
role-update-contextlevel
section-config-set
sql-cli
sql-dump
sql-run
theme-info
theme-settings-export
theme-settings-import
top
user-assign-system-role
user-create
user-delete
user-export
user-import-pictures
user-list
user-login
user-mod
user-unassign-system-role
userprofilefields-export
userprofilefields-import
webservice-call