Skip to content

Concourse Shell#

The Concourse Shell (CaSH) is a built-in interactive interface for working with Concourse. CaSH supports two input modes — CCL commands and Groovy scripting — and lays out each result as a table that fits your terminal. It also lets you read the data as it was at any moment, explore a record and its history full screen, watch a read refresh on an interval, and find any command, method or key with a fuzzy picker. Tab completion, signature hints, suggestions from your history, syntax highlighting, prepare mode and persistent history help with the rest.

Starting CaSH#

Warning

Make sure that Concourse is running before starting CaSH.

1
concourse shell

Connection Parameters#

Specify connection options to connect to a different server, port, or environment:

1
2
concourse shell -h server.example.com -p 1717 \
    -e production -u admin
Option Description Default
-h, --host Server hostname localhost
-p, --port Server port 1717
-e, --environment Environment name (default)
-u, --username Username admin
--password Password (prompts if omitted)
--prefs, --config Path to client config file
--format How results appear: table, json, csv or text table at the prompt, text otherwise
-i, --interactive Start a session even when the input isn’t a terminal, as in an IDE’s console

Non-Interactive Mode#

Run a single command and exit:

1
concourse shell --run "select from 1"

A command that fails prints its error to stderr, and CaSH exits with status 1.

Pipe a script to run its statements one after another:

1
concourse shell < setup.cash

When the input is not a terminal, CaSH shows no banner or prompt, writes each result to stdout, and stops at the first statement that fails. It writes that error to stderr and exits with status 1. A script whose statements all succeed exits with status 0. A statement can span lines while a quote or a bracket is open, as at the prompt. Without a terminal, CaSH can’t prompt for a password, so set it in the client preferences or pass --password.

An IDE’s console isn’t a terminal either, so start concourse shell --interactive there to get a session instead of a script.

Dual-Mode Input#

CaSH accepts input in two modes. It tries the CCL command parser first, and falls back to Groovy if that fails.

CCL Commands#

Use natural, SQL-like syntax for common operations:

1
2
3
4
[default/cash]$ select "name", "age" from 1
[default/cash]$ find "age > 30"
[default/cash]$ add "name", "Jeff", 1
[default/cash]$ get "name" from 1 at "yesterday"

Groovy Mode#

For complex logic or operations not covered by CCL syntax, use the full Groovy 4 scripting language, along with its datetime, json, nio, sql, templates and xml modules. The concourse variable provides access to the complete Concourse API:

1
2
3
4
[default/cash]$ concourse.select(1)
[default/cash]$ concourse.find("age > 30")
[default/cash]$ concourse.get("name", 1,
    Timestamp.fromString("yesterday"))

You can leave off the concourse. prefix, and the parentheses of a call that takes no arguments, so getServerVersion runs concourse.getServerVersion(). For example:

1
2
[default/cash]$ select("name", find("age > 30"))
[default/cash]$ getServerVersion

Other input without parentheses runs as written, so a list or map literal works at the prompt, as in [1, 2, 3].sum().

Combined Error Reporting#

If input fails both modes, CaSH reports errors from both parsers to help you diagnose the issue.

When Something Goes Wrong#

A command that fails prints its error, and the session keeps running. That holds for a CCL command, for Groovy input, for a colon command, and for a stage, commit or abort that fails. It also holds for a Groovy assert that fails and for input that recurses so deeply that it overflows the stack.

Press Ctrl+C to stop Groovy input that runs too long, such as a loop that never ends. CaSH prints Interrupted and shows the next prompt. A call to Concourse Server can’t be interrupted, so Ctrl+C during one leaves the session running, and the prompt returns when the call ends. At the prompt, Ctrl+C clears the line, and on an empty line it reminds you to type :exit to quit.

When the connection to the server drops, the next command that needs the server tells you to reconnect. A security change, such as a new password for your user, ends the session with exit status 1, because every later request would fail.

Results#

CaSH lays out each result to fit the width of your terminal:

1
2
3
4
5
6
[default/cash]$ select name, age from 1, 2
Record │ name    │ age
───────┼─────────┼────
     1 │ Jeff    │  30
     2 │ Ashleah │  29
2 records in 0.011 sec

The layout follows the shape of the result:

  • A result for several records, such as a select or a diff, is a table with a column for each key.
  • Any other map, such as an audit or a browse, is a list of key and value pairs.
  • A set or list, such as the records from a find, is a list separated by commas.

A cell with one value shows that value alone, and a cell with several values separates them with commas. Links show as @<record>, and timestamps show the local date and time to the microsecond. When a table is too wide for the terminal, CaSH shortens its widest columns and wraps each value that no longer fits onto more lines of its column, and a column name that no longer fits ends with …. When that isn’t enough, CaSH opens the table at its full width in the pager, where the left and right arrow keys scroll sideways. A long value wraps the same way in every layout, and a line break in a value starts a new line. A faint footer counts the rows and shows how long the command took, and a blank line separates each result from the next prompt. In a diff, added values are green and removed values are red, and in an audit, each revision that adds is green and each revision that removes is red.

Output Formats#

:format shows how results appear, and :format <name> changes it:

  • table lays out results to fit the terminal, as above.
  • json writes pretty printed JSON in the form that Concourse reads, so you can paste it into an insert. A field that holds one value is that value, a link is "@<record>", a tag is quoted in backticks, and a timestamp is "|<microseconds>|".
  • csv writes comma separated values: a header row and a row per record for a table, a line per key for any other map, and a line per item for a set or list.
  • text writes Returned '<result>' in <seconds> sec.

The prompt starts in the format that you chose last, or in table if you never chose one. --run and piped scripts start in text. Pass --format to start in another format, as in concourse shell --format json < report.cash.

Wide Tables#

:wide shows how a table too wide for the terminal appears, even after its widest columns shrink as far as they go, and :wide <choice> changes it:

  • scroll, the default, opens the table at its full width in the pager. Each line is cut at the edge of the terminal, the left and right arrow keys scroll sideways, and q returns to the prompt.
  • blocks shows each record as a block with a line for each key that has a value.

The prompt starts with the choice that you made last. CaSH keeps your :format and :wide choices in ~/.cash_settings.

Reading the Past#

:at pins the session’s reads to a moment in the past, so you can look around the data as it was without writing a timestamp into each command:

1
2
3
[default/cash]$ :at "last friday"
Reading as of 2026-10-17 09:00:00.000000. Type :at now to read the present.
[default/cash@2026-10-17 09:00:00]$ select name, age where age > 30

The time can be any description that Concourse understands, microseconds, or a timestamp as CaSH shows it, such as one that you copy from an audit, which lands on that exact revision. Each select, get, find, browse, describe, navigate, verify, calculate, jsonify or trace that doesn’t name its own time reads as of that moment, including its where condition. A command that names its own time with at or as of keeps it. Writes, other commands and Groovy input run as written, and an input of several commands that includes a read fails, because CaSH pins one command at a time. While you read the past, CaSH prints a note after each Groovy input that it read the present. :at alone shows the time, and :at now returns to the present.

Record Explorer#

:explore <record> shows a record full screen, so you can move through its data, follow its links and step through its history:

1
[default/cash]$ :explore 1

While you read the past with :at, the explorer opens at the record’s newest revision as of that time, and a link you follow opens the linked record as of that time too. Without :at, a link opens the linked record now. [ and ] are the way to move through time.

The first line names the record and the time it shows, either now or the time of a revision. Each line below it holds a key and its values, styled the way a result shows them. The last line lists the keys you can press:

Key Action
↑, ↓, Page Up, Page Down, Home, End Move the selection
Enter Open the record that the selected line links to
←, Backspace Go back to the record you came from
[ Show the record as of its previous revision
] Show the record as of its next revision, or now
r Read the record again
q, Esc, Ctrl+C Return to the prompt

When a read from the server fails, the last line shows the error and the explorer stays open. A security change, such as a new password for the user, ends the session instead.

Watching a Read#

:watch runs a command again and again and shows its latest result full screen, the way watch does in a terminal:

1
[default/cash]$ :watch 5 select status where type = job

The number is the seconds between runs, and two when you leave it out. Press q or Ctrl+C to return to the prompt, or any other key to run the command again at once. A CCL command must only read, so :watch refuses one that writes; Groovy input runs as written each time. While you read the past with :at, the header names that time, or says that Groovy input reads the present. An error shows in place of the result, and the watch goes on, except that a security change ends the session.

Tab Completion#

CaSH provides context-aware tab completion. Press Tab to cycle through completions for:

  • Command verbs: select, find, add, get, etc.
  • Key names: Loaded from the server asynchronously
  • Values: The values of the key in a condition, such as where status =, when the key holds 25,000 values or fewer
  • Operators: =, >, <, contains, etc.
  • Colon commands: :help, :prepare, etc.
  • Method names: Concourse API methods and their signatures

Completions are grouped by category and include signature hints to guide parameter entry. Each command verb shows the signatures of its method, including a verb such as findorinsert whose method name has more than one word.

Signatures While You Type#

Inside an open call of an API method, such as find( or concourse.select(, the status line at the bottom of the terminal shows the method’s overload signatures. The hint follows the innermost open call and disappears when you close it.

Refreshing Completion Data#

Completion metadata is loaded from the server at startup. To reload it after schema changes:

1
[default/cash]$ :refresh

Fuzzy Picker#

Press Ctrl+T at the prompt to find a word and insert it at the cursor. The picker lists the command verbs, API methods, colon commands, functions from your run-commands file, and the keys that completion has loaded, with the kind of each word in faint text beside it.

Type a few of the word’s letters to filter the list. A word matches when it holds the letters in the same sequence, ignoring case, so slct finds select. Words that start with what you typed come first, then words that hold it whole, then the rest, with shorter words first in each group.

Key Action
↑, ↓ Move the selection
Enter Insert the selected word and close the picker
Esc, Ctrl+C Close the picker without a change

Syntax Highlighting#

CaSH highlights input in real time:

  • Command verbs in green
  • Colon commands in cyan
  • Groovy keywords in blue
  • Strings in yellow
  • Numbers in magenta
  • Comments in gray

Colon Commands#

CaSH provides built-in commands prefixed with : that control shell behavior.

Command Description
:help [command] Display help, optionally for a specific command
:prepare Enter prepare mode
:submit Submit all prepared commands
:discard Discard prepared commands
:stage Begin a transaction
:commit Commit the active transaction
:abort Abort the active transaction
:reconnect Re-establish connection to the server
:format [name] Show or set how results appear
:wide [choice] Show or set how a table too wide for the terminal appears
:edit Edit the previous input in an editor
:at [time] Show or pin the time that commands read
:refresh Reload completion metadata from the server
:history Display command history
:load <path> Load and execute a script file
:show records Display total record count
:explore <record> Browse a record and its revisions
:watch [seconds] <input> Run a read on an interval and show its latest result
:exit Exit CaSH

Getting Help#

:help shows an overview of CaSH. :help <topic> shows the manual page for a command, such as :help select, or describes a colon command, such as :help :at. A topic without help says so and points you back to :help.

Prepare Mode#

Prepare mode lets you queue multiple commands and submit them as a batch. This is useful for building up a sequence of operations (including transactions) before executing them.

Enter Prepare Mode#

1
[default/cash]$ :prepare

The prompt changes to indicate prepare mode and shows the number of queued commands:

1
[default/cash:prepare(0)]$

Queue Commands#

Type commands as usual. Instead of executing immediately, they are queued:

1
2
3
4
[default/cash:prepare(0)]$ stage
[default/cash:prepare(1)]$ add "name", "Jeff", 1
[default/cash:prepare(2)]$ add "age", 30, 1
[default/cash:prepare(3)]$ commit

Submit or Discard#

Submit all queued commands:

1
[default/cash:prepare(4)]$ :submit

Or discard them:

1
[default/cash:prepare(4)]$ :discard

Transaction Validation#

CaSH validates transaction semantics as you queue commands. It warns you about issues like:

  • commit without a preceding stage
  • Nested stage calls
  • Unmatched abort

Run Commands File#

CaSH automatically loads and executes a .cashrc file from your home directory at startup. This seeds each session with common configuration, custom functions, and variables. If the file doesn’t compile, or fails when it runs, CaSH prints its errors and exits with status 1, so you can fix the file or start with --no-run-commands.

Loading a File#

:load <path> runs another file in the current session, and its functions and variables stay available afterward. CaSH names the file that it loaded, and reports a file that doesn’t exist or doesn’t compile.

Custom Run Commands File#

1
concourse shell --run-commands /path/to/my-cashrc

Disable Run Commands#

1
concourse shell --no-run-commands

Custom Functions#

Define reusable functions in .cashrc using Groovy syntax:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def showKeys() {
  allkeys = describe(inventory()).values()
  result = []
  allkeys.each { keys ->
    keys.each { key ->
      result << key
    }
  }
  result.toSet()
}

Then invoke them in any session:

1
2
[default/cash]$ showKeys()
Returned '[manager, name, follows, age, friends]'

Custom Variables#

Define variables that are available throughout the session:

1
2
// .cashrc
defaultRecords = [1, 2, 3, 4, 5]

The Last Result#

_ holds the value that the last command or Groovy input returned, so Groovy input can build on it:

1
2
3
[default/cash]$ find age > 30
[default/cash]$ stage
[default/cash:txn]$ select("name", _)

An input that fails or returns nothing, such as stage, leaves _ unchanged.

Built-in Functions#

CaSH provides several built-in utility functions:

time()#

Return the current timestamp or parse a natural language time description:

1
2
3
[default/cash]$ time()
[default/cash]$ time("yesterday")
[default/cash]$ time("3 days ago")

show()#

Display information about records:

1
[default/cash]$ show records

History#

CaSH maintains a persistent command history in ~/.cash_history. History survives across sessions. On a file system with POSIX permissions, only you can read the history file. CaSH never saves an input that calls createUser or Concourse.connect or mentions a password.

View History#

1
[default/cash]$ :history

Use the up and down arrow keys to scroll through previous commands.

Edit the Previous Input#

:edit opens your previous input, even one that failed, in the editor that $VISUAL or $EDITOR names, or in a built-in nano if neither is set. When you save and quit, CaSH puts the edited text at the prompt so you can review it and press Enter to run it. If the editor exits with an error, the text stays as it was. The built-in nano needs a terminal that can move its cursor, so in an IDE’s console, set $VISUAL or $EDITOR to use :edit.

Suggestions From History#

As you type, CaSH shows the rest of the newest history entry that starts with your input, after the cursor in faint text. Press the right arrow key or Ctrl+E to accept all of it, or Alt+F to accept its next word. Keep typing to ignore it.

Automatic Paging#

When output exceeds twice the terminal height, CaSH shows it in a pager that runs inside the shell, so it works anywhere, including on Windows and in containers without less. The usual less keys work, such as space, b, / to search and h for help. The pager exits when you press q, and the last screen stays on the terminal. A table too wide for the terminal also opens in the pager, where it scrolls sideways, as Wide Tables describes.

Reconnecting#

If the connection to the server is lost, use :reconnect to re-establish it using the same credentials:

1
[default/cash]$ :reconnect

CaSH also detects connection loss automatically and prompts you to reconnect.

Multi-Line Input#

CaSH supports multi-line input. Lines ending with an open parenthesis, bracket, brace, or escaped newline continue to the next line:

1
2
3
4
5
6
[default/cash]$ concourse.find(
>     Criteria.where()
>         .key("age")
>         .operator(Operator.GREATER_THAN)
>         .value(30)
>         .build())

The secondary prompt > indicates that CaSH is waiting for more input.

Dynamic Prompt#

The CaSH prompt displays the current environment and mode:

1
2
3
4
5
[default/cash]$              # Normal mode
[production/cash]$           # Connected to "production"
[default/cash:txn]$          # A transaction is open
[default/cash:prepare(3)]$   # Prepare mode with 3 queued
[default/cash@2026-10-21 14:03:22]$   # Reading the past