Before you can make use of Moosh, you will have to install it (see Chapter 8, Moodle Plugins). Once it's been installed, you have a vast number of commands (at the time of writing over 80!) at your disposal.
The general syntax of Moosh is as follows:
moosh <command> <options>
To give you an idea of the types of things you can do with Moosh, we will show you a number of examples.
Tasks |
Commands |
Description |
---|---|---|
Clear cache |
|
This is the equivalent of |
Show all plugin types |
|
Displays a list of all installed plugins and their installation location. |
Create a user |
|
Create a user with user name test. |
Create 10 users |
|
This type of enumeration can be used with a number of Moosh commands. |
Create a user with some optional values |
|
All values are supported; this is just a sample. |
Show all files in a course |
|
Outputs information on all files in course with ID |
Once you combine Moosh commands with standard shell commands via pipes and streams, you have a powerful arsenal of commands at hand. For example, you might want to find all backups that are larger than 10 MB, archive them, and reclaim the space.
The following example output of Moosh shows the output of the config-get
command, which lists the value(s) of all configuration settings in Moodle:
For a full list of well over 80 commands and hundreds of options, please refer to the Moosh site at http://moosh-online.com/commands/. The list is growing constantly, so make sure you have the latest version installed.
18.191.210.205