neo4j-client(1) command shell for Neo4j


neo4j-client [options...] [URL | host[:port]]


neo4j-client is a command shell for Neo4j. It supports secure connections to Neo4j server, sending of statements (including multiline statements), persistent command history, and rendering of results to tables or CSV.

neo4j-client requires Neo4j Server version 3.0 or later.


--help, -h
Display a brief help listing.
Use the specified file for saving history.

By default, history is saved to $(HOME)/.neo4j/client-history.

Do not save the command history.
Specify a file containing trusted certificates (and CRLs). The file should contain one or more certificates in PEM format.
Specify a directory containing trusted certificates (and CRLs). The certificates should have names of the form: hash.0 or have symbolic links to them of this form ("hash" is the hashed certificate subject name: see the -hash option of the x509 utility). Under Unix the c_rehash script will automatically create symbolic links to a directory of certificates.
Do not attempt to establish a secure (TLS) connection to Neo4j.
Use non-interactive (batch) mode and do not prompt for credentials when connecting.
--username=name, -u name
Use the specified username when connecting.

The username (and password) can also be supplied in the connection URL, and will override what is set here.

--password=pass, -p pass
Use the specified password when connecting.

The password (and username) can also be supplied in the connection URL, and will override what is set here.

Prompt for a password, even in non-interactive (batch) mode. This option requires that neo4j-client is being run with a controlling TTY, which will be used for password prompting and input.
When using secure (TLS) connections, the certificate signatures of previously verified hosts is persisted to the known hosts file. This setting specifies the location of that file.

By default, the file is $(HOME)/.neo4j/neo4j_known_certs.

Do not do host checking via known-hosts (use only TLS certificate verification).
-v, --verbose
Increase the logging verbosity. Each invocation increases the verbosity. Each verbosity level roughly equates to logging of warnings, general information, debug output and trace information.
Print the neo4j-client version and exit.


A URL may be specified on the command line, and will cause neo4j-client to attempt to connect to the specified server immediately. The URL is of the form neo4j://host[:port], and specifies the host and port the Neo4j server is listening on.


When neo4j-client is started with standard input connected to an interactive terminal, it will run in interactive mode. This will present a command prompt to the user and will evaluate each command as it is entered. The history of entered commands will be saved (unless disabled) and an errors in evaluation will be presented to the user. Results from statements sent to Neo4j will be presented to the user in table format (by default), using the full width of the terminal.


When neo4j-client is started with standard intput connected to a pipe, it will read statements from the pipe and evaluate each. Any error in evaluation will cause neo4j-client to terminate without evaluating any further input. Results from statements sent to Neo4j will be output in CSV format (by default).


Once started, commands and statements can be entered at the neo4j-client prompt. Commands always begin with a colon (:) and conclude at the end of the line, e.g. :help, and are evaluated by neo4j-client rather than being sent to the Neo4j server. Statements do not begin with a colon (:), may span multiple lines, are terminated with a semi-colon (;) and will be sent to the Neo4j server for evaluation.


neo4j-client understands a variety of commands, including:
List all the available commands and usage information.
:quit (or :exit)
Exit neo4j-client.
:connect '<url>'
Connect to the Neo4j server specified by the URL. Note that the URL must be given in quotes, as the // characters in the URL would otherwise be considered as the start of a comment.
:connect <host>[:<port>]
Connect to the Neo4j server specified by the host and optional port.
Disconnect from the Neo4j server (if connected).
:export [name=val] ...
Export parameters for queries. The parameter will be available in queries as {name}, and will be a string containing the text specified. Values containing spaces must be quoted, e.g. :export name="foo bar". Multiple name and value pairs may be specified. If no name and value pairs are specified, then the list of currently exported values will be displayed.

Note that all parameters are sent to the server for every query, so it is best not to export large values without immediately using :unexport after.

:unexport name ...
Remove a named parameter from those exported to queries.
Reset the session with the server, aborting any open transactions.
:set [option=value] ...
Set various shell options. If no option name and value paris are specified, then the list of current options and their values will be displayed.
Show the client connection status, which indicates if the client is disconnected or connected to a server. If the latter, the connection URI is output.
:output (table|csv)
Set the output format to either table or CSV.

Equivalent to `:set output=(table|csv)`.

:width <n>
Set the output width for table rendering. n is either an integer between 2 and 4095, or auto. In interactive mode, the default is auto, which sets the output width to match the width of the terminal. In non-interactive (batch) mode, the default is 70.

Equivalent to `:set width=<n>`.


Start neo4j-client in interactive mode, and run a query:

    $ neo4j-client neo4j://localhost:7687
    neo4j> MATCH (n:Person) RETURN, n.born LIMIT 4;
    |                      | n.born                      |
    | Keanu Reeves                | 1964                        |
    | Carrie-Anne Moss            | 1967                        |
    | Laurence Fishburne          | 1961                        |
    | Hugo Weaving                | 1960                        |
    neo4j> :quit

Evaluate a query using neo4j-client in non-interactive (batch) mode, saving the output to a csv file:

    $ echo "MATCH (n:Person) RETURN, n.born LIMIT 4;" | \
            neo4j-client neo4j://localhost:7687 > result.csv
    $ cat result.csv
    "Keanu Reeves",1964
    "Carrie-Anne Moss",1967
    "Laurence Fishburne",1961
    "Hugo Weaving",1960


In interactive mode, neo4j-client attempts to exit cleanly (with $? set to 0) when the session is terminated via the use of :quit, :exit or ctrl-D, and to use a non-zero exit code otherwise. In non-interactive (batch) mode, neo4j-client will exit cleanly if all statements read from stdin evaluate successfully.


This man page is current for version 1.0.0 of neo4j-client.


Chris Leishman (