Skip to content

Built-in Commands

Built-in commands are handled directly by the backend daemon without spawning external processes. They are resolved before PATH lookup.

CommandDescription
jobsList all running and stopped background jobs for the current session.
fg [%n]Bring job n to the foreground. Without argument, uses the most recent job.
bg [%n]Resume a stopped job in the background. Without argument, uses the most recent job.

Job IDs accept both %n and bare n syntax.

z performs frecency-based directory jumping. It searches the frequency database (maintained by the frequency plugin) for the best-matching previously visited directory.

z proj # jumps to /home/user/workspace/project (best match)
z doc # jumps to /home/user/Documents
z # shows interactive picker with most visited directories
z - # returns to the previous directory

Interactive picker (z with no arguments): Displays a vertical list of the top 10 most visited directories, ranked by frecency score. Each entry shows the full path and visit count. Navigate with arrow keys and confirm with Enter.

Previous directory (z -): Switches to the last directory visited before the current one, similar to cd -. Prints the target path on success.

If no match is found, a helpful error suggests running z to browse visited directories. If the matched directory no longer exists, an error is reported.

set modifies runtime settings for the current session.

set turbo on # enable turbo mode
set turbo off # disable turbo mode
SubcommandDescription
session export <id>Outputs a clean script of successful commands from the named session.
session search <pattern>Searches all session files for commands matching the pattern.

Session IDs correspond to filenames in ~/.lash/sessions/ (without the .jsonl extension).

The audit command manages the tamper-evident audit log. See the Security and Audit reference for full details.

CommandDescription
audit initInitialize audit system.
audit verifyVerify the integrity of the audit log.
audit rotateVerify log, delete if valid, reset chain.

All audit commands require the auditAccess capability.

role # prints current role (no password needed)
role user # switch to user role (no password needed)
role admin # switch to admin role (REQUIRES audit password)

Switching to a role with auditAccess requires entering the audit password.

These built-in functions are available in expression context:

FunctionDescription
prompt(msg [, default])Reads a line of text from stdin. Optional default value returned if input is empty.
confirm(msg)Yes/no question, returns bool.
password(msg)Reads input with echo disabled.
choose(msg, options)Numbered menu, returns selected string.
enforce(cond, msg)If false, prints msg to stderr and exits 1.
confirm_when(cond, msg)If true, warns and prompts to continue. Exits if declined.

All prompts write to stderr (pipe-safe).

let name = prompt("Your name: ")
let name = prompt("Your name: ", "Anonymous") # with default
let env = choose("Environment:", ["dev", "staging", "prod"])
enforce(version > 0, "Version must be positive")