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.
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
| Key | Action |
|---|---|
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 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 key | What it does | Global key | What it does |
|---|---|---|---|
s | Select current row | gs | Select ALL rows |
d | Delete current row | gd | Delete ALL selected rows |
_ | Expand current column | g_ | Expand ALL columns |
/ | Search in current column | g/ | Search ALL columns |
[ | Sort by current column | g[ | Sort by all key columns |
z prefix — precise variant
| Local key | z-variant | Meaning |
|---|---|---|
_ expand column | z_ set exact width | Full vs specific |
( expand list | z( expand to depth | Full 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
- Column Types and Casting — int, float, date types
- Row Selection — select rows by pattern, expression, value
- Key Columns — pin identifier columns with
!