Command-line client
nextcloudcmd synchronizes a local directory with a Nextcloud server, then exits. It can perform follow-up syncs
when needed, but it does not continuously monitor local files or poll for server changes like the desktop app.
For options passed to the desktop app’s nextcloud command, see Command-line options.
Installation
Install a package that provides nextcloudcmd. Availability depends on your operating system and package:
Operating system |
Package source |
|---|---|
Alpine Linux |
|
Debian |
|
Fedora |
|
Ubuntu |
|
Ubuntu PPA |
|
Windows |
Usage
Use an existing local directory and the base URL of the Nextcloud server:
nextcloudcmd [options] local_directory server_url
For example, synchronize the remote Music folder into an existing local folder:
nextcloudcmd --user carla --path /Music "$HOME/media/music" https://cloud.example.com
The client prompts for the password. You can use an app password from your Nextcloud account’s security settings.
Do not append a WebDAV endpoint to the server URL; use --path for a remote subfolder.
Run nextcloudcmd without arguments to display its help, or nextcloudcmd --version to display its version.
Options with values accept both --option value and --option=value.
Options
Parameter |
Default |
Description |
|---|---|---|
|
Server root |
Synchronize a remote subfolder, for example |
|
See credentials below |
Login name. Overrides the username in the server URL. |
|
See credentials below |
Password or app password. Overrides the password in the server URL. Command-line passwords may be visible in process listings and shell history. |
|
Not set |
Read credentials from a matching host or default entry in |
|
Not set |
Do not prompt for credentials. Read missing credentials from |
|
Not set |
Suppress Qt log messages. Does not suppress every console message. |
|
Not set |
Accept untrusted TLS certificates. Use only for a controlled diagnostic run; normally fix the certificate trust configuration. |
|
No explicit proxy |
Set an HTTP proxy using |
|
System exclude list |
Add an exclude list. The file must exist. Pattern anchoring depends on its filename; see Exclude lists. |
|
Not set |
Add an exclude list with patterns anchored at the sync root, regardless of the filename. |
|
Not set |
Read remote folders to exclude from synchronization, one relative path per line. Empty lines and lines starting
with |
|
|
Maximum number of follow-up runs when the sync engine requests another sync. This is not a general retry count for every failed request. |
|
|
Upload speed limit in KB/s (1000 bytes per second). Zero means unlimited. |
|
|
Download speed limit in KB/s (1000 bytes per second). Zero means unlimited. |
|
Hidden files included |
Include hidden files. This is already the default; |
|
Not set |
Enable Nextcloud debug logging and send log output to standard output. |
|
Standard location |
Use a different configuration directory. Does not make the one-run sync inherit all desktop sync settings. |
|
Not requested |
Display version information and exit. Run this option without the directory and server arguments. |
Credential handling
Credentials are read in this order:
Username and password in the server URL, if supplied.
--userand--password, which replace the corresponding URL values.A matching host or default
.netrcentry when-nis used, which replaces both values.Prompts for any missing values, or the environment variables below when
--non-interactiveis used.
Prefer a password prompt or a protected .netrc file over putting passwords in a command or URL.
Parameter |
Default |
Description |
|---|---|---|
|
Unset |
Username fallback for a one-run sync with |
|
Unset |
Password fallback for a one-run sync with |
These variables do not supply credentials for the account setup mode below.
For transfer overrides shared with the desktop sync engine, see Environment variables.
nextcloudcmd uses an initial chunk size of 100 MiB, a minimum of 5 MB, a maximum of 5 GB, and 6 parallel jobs unless
overridden by those variables. It does not read the desktop app’s chunk-size settings from nextcloud.cfg.
Exclude lists
The client loads the system exclude list when available. You can add your own list with --exclude or
--exclude-anchored. A missing explicitly supplied file is an error.
With --exclude, a file named sync-exclude.lst uses the sync root for pattern matching. Other filenames can use
the exclude file’s directory as the base. Use --exclude-anchored when the filename and location should not affect
matching.
Write one pattern per line. Wildcards are supported, for example:
*.tmp
._*
Thumbs.db
Account setup
nextcloudcmd can also save an account for use by the desktop app. The presence of --userid selects this mode;
omit the positional local directory and server URL used for a one-run sync. The command exits after setup completes.
Parameter |
Default |
Description |
|---|---|---|
|
Required |
User ID for the account to create. Use together with |
|
Required |
Base URL of the Nextcloud server, for example |
|
Not set |
App password for the account. If omitted, the account is saved and you must log in from the desktop app later. |
|
Suggested folder |
Local sync folder. If omitted, use the folder suggested by the setup wizard. An existing folder must be empty. Ignored when macOS File Provider mode is enabled. |
|
|
Remote folder for the new classic sync connection. Applies when a local sync folder is created. |
|
|
Use |
For example, save an account and log in from the desktop app afterward:
nextcloudcmd --userid carla --serverurl https://cloud.example.com --localdirpath "$HOME/Nextcloud"