Skip to main content

Sheet Stack and Prefix Keys

Three concepts power every operation in VisiData: the sheet stack (how views stack on top of each other), g/z prefix keys (how commands scale), and the command palette (how to discover commands). Master these and every other feature becomes intuitive.

Learning Focus

Press q to go back, Shift+S to see all sheets. Prefix g to apply a command to all/selected, z for a precise variant. Press Space to search commands by name.

Sample Data

mkdir -p ~/github/practice-folder/visidata/01-loading
cat > ~/github/practice-folder/visidata/01-loading/servers.csv << 'EOF'
hostname,role,status,region
web01,webserver,active,sg
web02,webserver,standby,sg
db01,database,active,kl
cache01,cache,active,sg
monitor01,monitoring,standby,jk
EOF

Concept 1: The Sheet Stack

Every VisiData action either operates on the current sheet or pushes a new derived sheet on top. Nothing destroys the original — you just navigate deeper.

Think of it like browser tabs: you go forward into a derived view, press q to go back.

servers.csv ──Shift+F──▶ Frequency Table ──q──▶ (back to source)
servers.csv ──Shift+I──▶ Describe Sheet ──q──▶ (back to source)
servers.csv ──Shift+C──▶ Columns Sheet ──q──▶ (back to source)

Navigate the sheet stack:

vd ~/github/practice-folder/visidata/01-loading/servers.csv

# Press Shift+F → frequency table opens (new sheet on stack)
# Press q → back to servers.csv
# Press Shift+I → describe sheet opens
# Press q → back to servers.csv
# Press Shift+S → see all open sheets at once
# Press Enter on a sheet → jump to it
KeyAction
qPop the top sheet (go back one)
gqQuit all sheets (exit VisiData)
Shift+SOpen 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 never modify the original file.


Concept 2: The g and z Prefix Keys

Many VisiData keys have g and z variants that change the command scope.

g prefix — apply to all/selected

Local keyWhat it doesGlobal keyWhat it does
sSelect current rowgsSelect ALL rows
dDelete current rowgdDelete ALL selected rows
_Expand current columng_Expand ALL columns
/Search in current columng/Search ALL columns
[Sort by current columng[Sort by all key columns

z prefix — precise variant

Local keyz-variantMeaning
_ expand columnz_ set exact widthFull vs specific
( expand listz( expand to depthFull vs depth

Prefix Key Reference

Prefix Scope
────── ─────────────────────────────────────────────
(none) Current row or column only
g All rows / all columns / all selected
z Reduced / exact / precise variant
gz Precise variant applied to all / selected

The pattern is predictable: if a key works on "current", its g version works on "all". If a key does "full", its z version does "precise".


Concept 3: The Command Palette

Don't know the shortcut for something? Press Space to open the command palette. Type any part of the command's name to find and run it.

Space → open command palette
Tab → cycle through suggestions
Enter → execute highlighted command

Example — find the frequency command via palette:

# Inside VisiData:
Space
# Type: freq
# Press Tab to cycle to 'freq-col'
# Press Enter → frequency table opens

Hands-On Practice

vd ~/github/practice-folder/visidata/01-loading/servers.csv

# Practice these in order:
# 1. Press Shift+F → frequency table opens (new sheet pushed)
# 2. Press q → back to source sheet
# 3. Press Shift+S → see all sheets (only source sheet)
# 4. Press gs → all rows selected (g prefix on s)
# 5. Press gu → deselect all
# 6. Press g_ → all columns expand to full width
# 7. Press Space → type 'describe' → Enter → describe sheet opens
# 8. Press gq → quit all sheets

What's Next