OCC/NCC Command

The OCC command is used to interact with your Nextcloud server instance from the command line. (CLI)

NCC Command

For NextcloudPi (NCP) instance users you can use the ncc command instead of the lengthy occ, which is nachoparker’s wrapper for the occ command.

sudo ncc [ args ]

OCC Command

sudo -u www-data php /var/www/nextcloud/occ [ args ]

List available commands

sudo ncc list


sudo -u www-data php /var/www/nextcloud/occ list

:::: Output ::::

user@hostname:~ $ sudo ncc list
Nextcloud 21.0.5

  command [options] [arguments]

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --no-warnings     Skip global warnings, show command output only
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  check                                  check dependencies of the server environment
  help                                   Displays help for a command
  list                                   Lists commands
  status                                 show some status information
  upgrade                                run upgrade routines after installation of a new release. The release has to be installed before.
  activity:send-mails                    Sends the activity notification mails
  app:check-code                         check code to be compliant
  app:disable                            disable an app
  app:enable                             enable an app
  app:getpath                            Get an absolute path to the app directory
  app:install                            install an app
  app:list                               List all available apps
  app:remove                             remove an app
  app:update                             update an app or all apps
  background:ajax                        Use ajax to run background jobs
  background:cron                        Use cron to run background jobs
  background:webcron                     Use webcron to run background jobs
  broadcast:test                         test the SSE broadcaster
  config:app:delete                      Delete an app config value
  config:app:get                         Get an app config value
  config:app:set                         Set an app config value
  config:import                          Import a list of configs
  config:list                            List all configs
  config:system:delete                   Delete a system config value
  config:system:get                      Get a system config value
  config:system:set                      Set a system config value
  cospend:export-project                 Export a project to CSV
  cospend:repeat-bills                   Repeat bills if necessary
  dav:create-addressbook                 Create a dav addressbook
  dav:create-calendar                    Create a dav calendar
  dav:list-calendars                     List all calendars of a user
  dav:move-calendar                      Move a calendar from an user to another
  dav:remove-invalid-shares              Remove invalid dav shares
  dav:send-event-reminders               Sends event reminders
  dav:sync-birthday-calendar             Synchronizes the birthday calendar
  dav:sync-system-addressbook            Synchronizes users to the system addressbook
  db:add-missing-columns                 Add missing optional columns to the database tables
  db:add-missing-indices                 Add missing indices to the database tables
  db:add-missing-primary-keys            Add missing primary keys to the database tables
  db:convert-filecache-bigint            Convert the ID columns of the filecache to BigInt
  db:convert-mysql-charset               Convert charset of MySQL/MariaDB to use utf8mb4
  db:convert-type                        Convert the Nextcloud database to the newly configured one
  deck:export                            Export a JSON dump of user data
  encryption:change-key-storage-root     Change key storage root
  encryption:decrypt-all                 Disable server-side encryption and decrypt all files
  encryption:disable                     Disable encryption
  encryption:enable                      Enable encryption
  encryption:encrypt-all                 Encrypt all files for all users
  encryption:list-modules                List all available encryption modules
  encryption:migrate-key-storage-format  Migrate the format of the keystorage to a newer format
  encryption:set-default-module          Set the encryption default module
  encryption:show-key-storage-root       Show current key storage root
  encryption:status                      Lists the current status of encryption
  federation:sync-addressbooks           Synchronizes addressbooks of all federated clouds
  files:cleanup                          cleanup filecache
  files:repair-tree                      Try and repair malformed filesystem tree structures
  files:scan                             rescan filesystem
  files:scan-app-data                    rescan the AppData folder
  files:transfer-ownership               All files and folders are moved to another user - shares are moved as well.
  group:add                              Add a group
  group:adduser                          add a user to a group
  group:delete                           Remove a group
  group:list                             list configured groups
  group:removeuser                       remove a user from a group
  groupfolders:create                    Create a new group folder
  groupfolders:delete                    Delete group folder
  groupfolders:expire                    Trigger expiry of versions for files stored in group folders
  groupfolders:group                     Edit the groups that have access to a group folder
  groupfolders:list                      List the configured group folders
  groupfolders:permissions               Configure advanced permissions for a configured group folder
  groupfolders:quota                     Edit the quota of a configured group folder
  groupfolders:rename                    Rename group folder
  groupfolders:scan                      Scan a group folder for outside changes
  groupfolders:trashbin:cleanup          Empty the groupfolder trashbin
  integrity:check-app                    Check integrity of an app using a signature.
  integrity:check-core                   Check integrity of core code using a signature.
  integrity:sign-app                     Signs an app using a private key.
  integrity:sign-core                    Sign core using a private key.
  l10n:createjs                          Create javascript translation files for a given app
  log:file                               manipulate logging backend
  log:manage                             manage logging configuration
  log:tail                               Tail the nextcloud logfile
  log:watch                              Watch the nextcloud logfile
  maintenance:data-fingerprint           update the systems data-fingerprint after a backup is restored
  maintenance:mimetype:update-db         Update database mimetypes and update filecache
  maintenance:mimetype:update-js         Update mimetypelist.js
  maintenance:mode                       set maintenance mode
  maintenance:repair                     repair this installation
  maintenance:theme:update               Apply custom theme changes
  maintenance:update:htaccess            Updates the .htaccess file
  migrations:execute                     Execute a single migration version manually.
  migrations:migrate                     Execute a migration to a specified version or the latest available version.
  migrations:status                      View the status of a set of migrations.
  notification:generate                  Generate a notification for the given user
  notification:test-push                 Generate a notification for the given user
  notify_push:log                        Temporarily set the log level of the push server
  notify_push:metrics                    Get the metrics from the push server
  notify_push:reset                      Cancel all active connections to the push server
  notify_push:self-test                  Run self test for configured push server
  notify_push:setup                      Configure push server
  preview:repair                         distributes the existing previews into subfolders
  preview:reset-rendered-texts           Deletes all generated avatars and previews of text and md files
  security:bruteforce:reset              resets bruteforce attemps for given IP address
  security:certificates                  list trusted certificates
  security:certificates:import           import trusted certificate in PEM format
  security:certificates:remove           remove trusted certificate
  serverinfo:update-storage-statistics   Triggers an update of the counts related to storages used in serverinfo
  sharing:cleanup-remote-storages        Cleanup shared storage entries that have no matching entry in the shares_external table
  sharing:expiration-notification        Notify share initiators when a share will expire the next day.
  sharing:list                           List who has access to shares by owner
  suspiciouslogin:seed                   Fills the database with random IPs for development and testing purposes
  text:reset                             Reset a text document
  trashbin:cleanup                       Remove deleted files
  trashbin:expire                        Expires the users trashbin
  trashbin:size                          Configure the target trashbin size
  twofactorauth:admin:generate-code      Generate a one-time 2FA code for users to log into their account
  twofactorauth:cleanup                  Clean up the two-factor user-provider association of an uninstalled/removed provider
  twofactorauth:disable                  Disable two-factor authentication for a user
  twofactorauth:enable                   Enable two-factor authentication for a user
  twofactorauth:enforce                  Enabled/disable enforced two-factor authentication
  twofactorauth:state                    Get the two-factor authentication (2FA) state of a user
  user:add                               adds a user
  user:add-app-password                  Add app password for the named user
  user:delete                            deletes the specified user
  user:disable                           disables the specified user
  user:enable                            enables the specified user
  user:info                              show user info
  user:lastseen                          shows when the user was logged in last time
  user:list                              list configured users
  user:report                            shows how many users have access
  user:resetpassword                     Resets the password of the named user
  user:setting                           Read and modify user settings
  versions:cleanup                       Delete versions
  versions:expire                        Expires the users file versions
  workflows:list                         Lists configured workflows

:::: EXAMPLE ::::

Here is an example output from executing the notify_push:self-test command

user@hostname:~ $ sudo ncc notify_push:self-test
[sudo] password for user: 
✓ redis is configured
✓ push server is receiving redis messages
✓ push server can load mount info from database
✓ push server can connect to the Nextcloud server
✓ push server is a trusted proxy
✓ push server is running the same version as the app

We hope this doc was helpful, if you encounter any issues or if one of the links no longer works, please reach out to the community. These docs are written by volunteers from the community, as another member of the same community, please consider helping out if there is anything you believe can be improved, fixed or changed.

If you have used NCP in a way not covered in these documents and articles above, have experience or knowledge to expand a section, please do so!
Reach out to the NCP Wiki volunteers on any of the channels listed below and send a message

Contact the Wiki volunteers team at Matrix or Telegram

Contact channels

1 Like

2 posts were merged into an existing topic: About moving the articles