Embedded Line Editor (kxline)
This page describes kxline, the embedded line editor used by KDB-X when you interact with the q terminal. It explains how kxline behaves in an interactive session, how to control it using environment variables, and which line-editing and history features it provides.
Overview
kxline is the embedded line editor used by KDB-X for interactive q sessions on Linux and macOS. It provides basic line editing and session history. This removes the need to install and use external tools such as rlwrap for most terminal-based workflows.
Windows console behavior
On Windows KDB-X relies on the native console behavior provided by the operating system rather than kxline. Refer to Keyboard shortcuts in Windows.
Supported features
The following sections describe the line-editing and command history features available in kxline interactive sessions.
Line editing
kxline provides single-line editing only. Supported actions include:
- Delete character before cursor:
Backspace(Ctrl+H). - Delete character after cursor:
Delete(Ctrl+D). - Move cursor:
Left/RightandHome/End(Ctrl+A/Ctrl+E). - Move cursor by word:
Ctrl+Left/Ctrl+Right(Alt+B/Alt+F). - Delete previous word:
Ctrl+W. - Delete to beginning or end of line:
Ctrl+U/Ctrl+K.
Mac key equivalents
Controlmaps toCtrl.Optionmaps toAlt.- The
Delete/⌫key deletes the character before the cursor (backspace behavior). - Forward delete may require
Fn+Delete/⌫, depending on keyboard and terminal. Home/Endbehavior is commonly accessed usingFn+Left/Right.
Session history
kxline maintains a persistent command history across interactive sessions.
- Navigate history using
Up/Down. -
Search history with
Ctrl+R.- Type to search.
- Use
Backspaceto erase. - Cancel with
Ctrl+G.
-
Read the history file
~/.q_historyon startup and append to it on exit.
Fixed history file location
kxline always uses ~/.q_history for command history. The path is not configurable.
Configuration
kxlineruns by default when q detects an interactive terminal (TTY).- To disable
kxline, setKX_LINE=0before starting q. - To force q to run interactively regardless of TTY detection, set
KX_TTY=1.
Example of forcing interactive mode in a pipe:
cat | KX_TTY=1 q
Next steps
- Explore available system commands in System commands.