VisiData Key Concepts
Before exploring VisiData's features, you must understand its four foundational concepts: the sheet stack, column types, the g-prefix modifier, and the command palette. These apply to every operation you will ever perform.
Understand these concepts now so that advanced commands in later modules make intuitive sense rather than feeling like random key memorization.
Concept 1: The Sheet Stack
Every VisiData action either operates on the current sheet or pushes a new derived sheet onto the stack.
q— pop the top sheet (go back one)gq— quit all sheets (exit VisiData)Shift+S— open the Sheets Sheet (navigate the full stack)Ctrl+^— swap to the previous sheet
Derived sheets (frequency tables, pivot tables) are views of the source data — they do not modify the original file.
Concept 2: Column Types
Every column has a type that controls sorting, aggregation, and display formatting. Untyped columns are treated as strings.
| Key | Type | Example display | Use for |
|---|---|---|---|
~ | String (default) | alice | Names, labels |
# | Integer | 42 | Counts, IDs |
% | Float | 3.14 | Prices, metrics |
$ | Currency | $3.14 | Financial data |
@ | Date | 2025-01-15 | Timestamps |
z# | Length | 7 | String length |
# Inside VisiData:
# Move cursor to a numeric column
# Press # → cast to integer
# Press % → cast to float
# Press @ → cast to date (auto-detects format)
Without setting column types, numeric columns sort lexicographically (1, 10, 2, 20). Always type-cast your numeric columns before sorting.
Concept 3: The g Global Modifier
Many VisiData keys have a g-prefixed global variant that applies the command to all rows or all columns instead of just the current one.
| Local key | Global key | Difference |
|---|---|---|
s select row | gs select all rows | Scope: one vs all |
d delete row | gd delete selected rows | Scope: one vs selected |
_ expand column width | g_ expand all columns | Scope: one vs all |
/ search in column | g/ search all columns | Scope: current col vs all |
[ sort ascending | g[ sort by all key columns | Scope: one vs key cols |
The z prefix often applies to a more precise or reduced variant:
| Key | z-variant | Meaning |
|---|---|---|
_ expand column | z_ set exact width | Full vs specific |
( expand list | z( expand to depth | Full vs depth |
Concept 4: Key Columns
Key columns are special columns that uniquely identify a row — like a primary key in a database. They appear with a blue highlight and affect joins, pivots, and sorting.
# Toggle key column on/off
!
# Unset key column
z!
Key columns anchor pivot tables and joins. Always set the right key column before using Shift+W (pivot) or & (join).
Concept 5: Row Selection
Operations like delete, yank, and export work on selected rows (highlighted in yellow) rather than all rows by default.
| Key | Action |
|---|---|
s | Select current row |
u | Unselect current row |
t | Toggle selection |
gs | Select all rows |
gu | Unselect all rows |
| | Select rows matching regex in current column |
g| | Select rows matching regex in any column |
z| | Select rows matching Python expression |
Concept 6: The Command Palette
Press Space to open the command palette. Type any part of a command's long name to find and execute it.
Space → open command palette
Tab → cycle through suggestions
Enter → execute highlighted command
This is the most discoverable way to find commands you do not yet have memorized.
Concept 7: Prefix Key Reference
Hands-On Practice
vd /tmp/servers.csv
# Practice these in order:
# 1. Press # on the column 'ip' → observe type indicator in header
# 2. Press ! on 'hostname' → it becomes a key column (blue)
# 3. Press s on row 1 → it turns yellow (selected)
# 4. Press gs → all rows selected
# 5. Press gu → deselect all
# 6. Press Space → type 'frequency' → Enter to open frequency table
# 7. Press q → return to source sheet