Options: --command COMMAND, -c COMMAND run only single command (SQL or internal) and exit --file FILE, -f FILE execute commands from file and exit --output OUTPUT, -o OUTPUT output file --username USERNAME, -U USERNAME database user name [default: mike] --password, -W force password prompt (should happen automatically) --no-password, -w never prompt for password --no-rc, -X do not read start up file --single-transaction, -1 execute as a single transaction (if non-interactive) --set SET, -v SET set variable NAME=VALUE --help, -h display this help and exit --version display version and exit
(not connected)=> \? General \q quit usql \copyright show usql usage and distribution terms \drivers display information about available database drivers \g [FILE] or ; execute query (and send results to file or |pipe) \gexec execute query and execute each value of the result \gset [PREFIX] execute query and store results in usql variables
Help \? [commands] show help on backslash commands \? options show help on usql command-line options \? variables show help on special variables
Query Buffer \e [FILE] [LINE] edit the query buffer (or file) with external editor \p show the contents of the query buffer \raw show the raw (non-interpolated) contents of the query buffer \r reset (clear) the query buffer \w FILE write query buffer to file
Input/Output \echo [STRING] write string to standard output \i FILE execute commands from file \ir FILE as \i, but relative to location of current script
Transaction \begin begin a transaction \commit commit current transaction \rollback rollback (abort) current transaction
Connection \c URL connect to database with url \c DRIVER PARAMS... connect to database with SQL driver and parameters \Z close database connection \password [USERNAME] change the password for a user \conninfo display information about the current database connection
Operating System \cd [DIR] change the current working directory \setenv NAME [VALUE] set or unset environment variable \! [COMMAND] execute command in shell or start interactive shell
Variables \prompt [TEXT] NAME prompt user to set internal variable \set [NAME [VALUE]] set internal variable, or list all if no parameters \unset NAME unset (delete) internal variable
my:root@localhost=> select * my:root@localhost-> from test my:root@localhost-> \p select * from test my:root@localhost-> \g test_id | name +---------+-------+ 1 | hello (1 rows)