Skip to main content

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.

Learning Focus

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
info

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.

KeyTypeExample displayUse for
~String (default)aliceNames, labels
#Integer42Counts, IDs
%Float3.14Prices, metrics
$Currency$3.14Financial data
@Date2025-01-15Timestamps
z#Length7String length
# Inside VisiData:
# Move cursor to a numeric column
# Press # → cast to integer
# Press % → cast to float
# Press @ → cast to date (auto-detects format)
warning

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 keyGlobal keyDifference
s select rowgs select all rowsScope: one vs all
d delete rowgd delete selected rowsScope: one vs selected
_ expand column widthg_ expand all columnsScope: one vs all
/ search in columng/ search all columnsScope: current col vs all
[ sort ascendingg[ sort by all key columnsScope: one vs key cols

The z prefix often applies to a more precise or reduced variant:

Keyz-variantMeaning
_ expand columnz_ set exact widthFull vs specific
( expand listz( expand to depthFull 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.

KeyAction
sSelect current row
uUnselect current row
tToggle selection
gsSelect all rows
guUnselect 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

What's Next