Save and Restore
How to save and replay a VisiData session
This example creates and then uses the file pivot.vdj.
To save and restore a session in VisiData:
Save the cmdlog using one of the following options:
a. Press
Ctrl+Dto save the cmdlog to afn.vdjfile.or
b. Press
Shift+Dto view theCommandLog Sheet, then pressCtrl+Sand save it with a.vdjsuffix.Press
gqto quit VisiData.Replay the cmdlog, on the commandline:
vd -p fn.vdj.
How to replay a cmdlog on a different file
Cmdlogs record the exact filename and sheet names from the original session. To reuse a cmdlog with a different input file, you need to make the cmdlog filename-independent.
Method: Edit the .vd/.vdj to remove hardcoded references
- Save your cmdlog as usual (
Shift+Dto open the cmdlog,Ctrl+Sto save). - Edit the
.vdjfile:- Remove the
open-fileline (the line with"longname": "open-file"). - Erase all
"sheet"values (for instance withgs gzd). A blank sheet name means "use the current sheet", so commands operate on whatever is on top of the stack.
- Remove the
- Replay on a new file:
vd -b -p cmdlog.vdj newfile.csv -o output.tsv
The new file is passed as a positional argument, and -p replays the cmdlog against it. Use -b for batch (non-interactive) mode and -o to write the result.
Limitations: Blank sheet names only work for linear workflows where you never switch between sheets. If your analysis involves joining sheets or switching back to a previous sheet, you'll need to either keep the sheet names, or use stack-relative commands like jump-prev (Ctrl+^, jump to previous sheet) or jump-first (gCtrl+^, jump to first sheet) to navigate between sheets without relying on their names.
Cmdlog formats
VisiData supports several cmdlog formats:
.vd(TSV) — original format with tab-separated columns.vdj(JSONL) — JSON objects, one per line; fields includesheet,col,row,longname,input,keystrokes,comment.vdx(simplified) — human-readable, one command per line; only emitssheet/col/rowlines when they change
