Command-Line Options

This article is part of the Getting Started Guide. Each BaseX Startup mode has one or more command-line options which are described in this article.

Command-line options can be specified multiple times. Please note that all options will be evaluated in the given order. The standard input can be parsed by specifying a single dash (-) as argument.

=Standalone=

The following options are available for the standalone Command-Line Client:

$ basex -h BaseX [Standalone] Usage: basex [-bcdiIoqrRstuvVwxz] [input] [input]   XQuery or command file, or query string -b  Bind external query variables -c Execute commands from file or string -d        Toggle debugging output -i Bind file or database to context -I Bind input string to context -o  Write output to local file -q  Execute XQuery expression -r   Run query multiple times -R        Toggle query execution -s  Set serialization parameters -t[path]  Run tests in file or directory -u        Toggle updates in original files -v        Toggle output of progress info -V        Toggle detailed query output -w        Toggle whitespace chopping -x        Toggle output of query plan -z        Toggle output of query result

Further details are listed in the following table. If an equivalent database option exists (which can be specified via the  command), it is listed as well. For the examples to work, it might be necessary to escape some characters depending on your operating system.

=GUI=

The following options are available for the standalone Graphical User Interface:

$ basexgui -h BaseX [GUI] Usage: basexgui [-d] [files] [files] Open specified files -d Enable debugging

You can pass one or more files as parameters. If an XML document is specified, a database instance can be created from this file. Other files are opened in the editor.

=Server=

The following options are available for the Database Server:

$ basexserver -h BaseX [Server] Usage: basexserver [-cdnpSz] [stop] stop      Stop running server -c Execute commands from file or string -d        Enable debugging output -n  Set host the server is bound to  -p   Set server port -S        Start as service -z        Suppress logging

Details on all options are listed in the following table (equivalent database options are shown in the table as well). For the examples to work, it might be necessary to escape some characters depending on your operating system.

Multiple -c and -i flags can be specified. All other options will be set before any other operation takes place. The specified inputs, query files, queries and commands will be subsequently evaluated after that in the given order. The standard input can be parsed by specifying a single dash (-) as argument.

=Client=

If the Database Client is executed, the user name and password will be requested on command-line. The initial user/password combination is admin/admin. The following options are available:

$ basexclient -h BaseX [Client] Usage: basexclient [-bcdiInopPqrRsUvVwxz] [input] [input]   XQuery or command file, or query string -b  Bind external query variables -c Execute commands from file or string -d        Toggle debugging output -i Bind file or database to context -I Bind input string to context -n  Set server (host) name -o  Write output to local file -p  Set server port -P  Specify user password -q  Execute XQuery expression -r   Run query multiple times -R        Toggle query execution -s  Set serialization parameters -U  Specify user name -v        Toggle output of progress info -V        Toggle detailed query output -w        Toggle whitespace chopping -x        Toggle output of query plan -z        Toggle output of query result

See the following table for details (equivalent database options are shown in the table as well). For the examples to work, it might be necessary to escape some characters depending on your operating system.

=HTTP Server=

-g option (GZIP enable support)

The following options are available for the HTTP Server:

$ basexhttp -h BaseX [HTTP] Usage: basexhttp [-cdhlnpsSUz] [stop] stop      Stop running server -c Execute commands from file or string -d        Enable debugging output -g        Enable GZIP support -h  Set port of HTTP server -l        Start in local mode -n  Set host name of database server -p  Set port of database server -s  Specify port to stop HTTP server -S        Start as service -U  Specify user name -z        Suppress logging

The meaning of all options is listed in the following table (equivalent database options are shown in the table as well). For the examples to work, it might be necessary to escape some characters depending on your Operating System.

=Changelog=


 * Version 9.0


 * Added: BaseXHTTP, command-line option -c.
 * Updated: BaseXHTTP, command-line option -c, additionally accepts valid URLs and file references.


 * Version 8.2


 * Removed: Event ports, -e.


 * Version 8.1


 * Added: Bind input strings to the query context with -I.


 * Version 8.0


 * Removed: Command-line option  (results will now be automatically separated by newlines).


 * Version 7.9


 * Added: Runs tests in file or directory with -t.
 * Removed: interactive server mode.


 * Version 7.8


 * Added: Specify if a query will be executed or parsed only with -R.


 * Version 7.7


 * Added: Bind host to the BaseX Server with -n.


 * Version 7.5


 * Added: detection of Command Scripts.
 * Removed: HTTP server flags -R, -W, and -X.


 * Version 7.3:


 * Updated: all options are now evaluated in the given order.
 * Updated: Create main-memory representations for specified sources with -i.
 * Updated: Options -C/-c and -q/[input] merged.
 * Updated: Option -L also separates serialized items with newlines (instead of spaces).


 * Version 7.2:


 * Added: RESTXQ Service


 * Version 7.1.1:


 * Added: Options -C and -L in standalone and client mode.


 * Version 7.1:


 * Updated: Multiple query files and -c/-i/-q flags can be specified.