Quick Reference

Cheatsheets

Practical command references for Linux, networking, servers, containers, databases, and more.

Cheatsheet#nextcloud-cheatsheet

Nextcloud Cheatsheet

Nextcloud is an open-source, self-hosted file share and collaboration platform. Most administration is done via the occ (ownCloud Console) command-line tool.

Important: The occ command must be run as the web server user (usually www-data on Debian/Ubuntu or apache on RHEL/CentOS).

Basic occ Execution

Navigate to your Nextcloud directory (e.g., /var/www/nextcloud) first, or provide the full path.

# Run occ (Ubuntu/Debian)
sudo -u www-data php /var/www/nextcloud/occ
 
# Alias for convenience (Add to ~/.bashrc)
alias occ='sudo -u www-data php /var/www/nextcloud/occ'

System and Maintenance

occ status                 # Show Nextcloud version and status
occ maintenance:mode --on  # Enable maintenance mode (disables web access)
occ maintenance:mode --off # Disable maintenance mode
occ upgrade                # Run the upgrade routine after updating files

User Management

occ user:list              # List all users
occ user:add john          # Add a new user named 'john'
occ user:resetpassword john # Reset password for 'john'
occ user:disable john      # Disable a user account
occ user:enable john       # Enable a user account
occ user:delete john       # Permanently delete a user and their data

App Management

occ app:list               # List installed and available apps
occ app:enable calendar    # Enable an app
occ app:disable calendar   # Disable an app
occ app:install calendar   # Download and install an app

File Scanning

If you manually add files directly to the server's filesystem, Nextcloud won't see them until you scan.

occ files:scan --all       # Scan files for all users (Can take a long time!)
occ files:scan john        # Scan files only for user 'john'

Security and Configuration

occ security:bruteforce:reset 192.168.1.50 # Unban an IP address
occ config:system:set trusted_domains 1 --value=my.nextcloud.com # Add a trusted domain