CLI ADMINISTRATION
While Nextcloud has a well-rounded yet intuitive graphical interface, it also includes a powerful command line interface (CLI) that can be used to control all aspects of the installation. Nextcloud’s CLI is a PHP script that gets its name from its origins in owncloud and is called occ (for owncloud Console).
To use occ, move to the Nextcloud base directory (such as /var/ www/nextcloud), and then run it with the web server’s owner (usually www-data or apache) in order to maintain the correct permissions on the Nextcloud files and folders. The sudo -u www-data php occ -V command fetches the version of the Nextcloud server you’re running. Using the list option such as sudo -u www-data php occ list displays all the supported commands and options. The occ equivalent of creating a new user is sudo -u www-data php occ user:add --display-name=”peter P.” --group=”it” peter , which creates a user named peter with the display name Peter P in the IT group of users.
You can use occ to streamline common administration tasks. For example, the command sudo -u www-data php occ maintenance:mode --on prevents users from logging into the server while you do maintenance tasks on the installation, such as backups and upgrades. If your day job involves administering a Nextcloud installation, it would be really beneficial if you spent some time familiarising yourself with the occ CLI interface.