Command Line Interface#
The Presto CLI is a terminal-based interactive shell for running queries, and is a self-executing JAR file that acts like a normal UNIX executable.
Install the Presto CLI#
Rename the JAR file to
presto with the following command:
mv presto-cli-0.285.1-executable.jar presto
chmod +x to make the renamed file executable:
chmod +x presto
Run the Presto CLI#
Start the Presto CLI using the name you gave it using the
The Presto CLI starts and displays the prompt
To exit the Presto CLI, enter
Run the CLI with the
--help option to see the available options.
Connect to a Presto server using the Presto CLI#
To connect to a Presto server, run the CLI with the
./presto –server localhost:8080 –catalog hive –schema default
localhost:8080 is the default for a Presto server, so if you have a Presto server running locally you can
leave it off.
To connect to a remote Presto server, use the Presto endpoint URL as in the following example command
./presto –server http://www.example.net:8080
The Presto CLI paginates query results using the
less program, which
is configured with preset options. To change the pagination of query results, set the
PRESTO_PAGER to the name of a different program such as
or set it to an empty value to disable pagination.
The Presto engine and client communicate over HTTP using a REST API, documented at Presto Client REST API.