LinuxCommandLibrary

cypher-shell

TLDR

Connect to Neo4j with default settings

$ cypher-shell
copy
Connect with credentials
$ cypher-shell -u [username] -p [password]
copy
Connect to specific address
$ cypher-shell -a [bolt://localhost:7687]
copy
Execute a query and exit
$ cypher-shell "MATCH (n) RETURN count(n)"
copy
Execute queries from file
$ cypher-shell -f [queries.cypher]
copy
Connect to specific database
$ cypher-shell -d [neo4j]
copy
Output in plain format
$ cypher-shell --format plain "MATCH (n) RETURN n LIMIT 5"
copy

SYNOPSIS

cypher-shell [options] [query]

DESCRIPTION

cypher-shell is the command-line interface for executing Cypher queries against Neo4j graph databases. Cypher is Neo4j's declarative query language for creating, reading, updating, and deleting graph data.
In interactive mode, it provides a REPL environment for exploring graph data, with command history and basic editing. Non-interactive mode executes queries and returns results, useful for scripting and automation.
The shell supports transaction management, allowing multiple statements to be executed atomically. It can output results in various formats suitable for human reading or machine parsing.

PARAMETERS

-a ADDRESS, --address ADDRESS

Connection address (default: bolt://localhost:7687).
-u USER, --username USER
Neo4j username.
-p PASSWORD, --password PASSWORD
Neo4j password.
-d DATABASE, --database DATABASE
Database to connect to.
-f FILE, --file FILE
Execute Cypher queries from file.
--format FORMAT
Output format: auto, verbose, plain.
--encryption MODE
Encryption mode: true, false, default.
--version
Display version information.
--help
Display help information.

CAVEATS

Passwords passed on command line may be visible in process listings. Large result sets can consume significant memory. Some Cypher features require specific Neo4j versions. Encrypted connections require proper certificate configuration.

HISTORY

cypher-shell was introduced by Neo4j as part of their database tooling. It replaced the older neo4j-shell, providing better support for modern Neo4j features and the Bolt protocol introduced in Neo4j 3.0 in 2016.

SEE ALSO

Copied to clipboard