stash [file]
stash push [file]
stash tee
stash path [id|n|@n]
stash attr <id|n|@n>
stash attrs [--count]
stash cat [id|n|@n]
stash ls
stash pop
stash rm <id|n|@n>...
stash rm --before <id|@n>
stash rm -a <name|name=value>
stash-completion <bash|zsh|fish>
Without a subcommand, stash uses smart mode:
- in the middle of a pipeline, it behaves like
stash tee - otherwise, it behaves like
stash push
stash push always stores input and returns the new entry ID only if asked:
stash push file.txt
stash push --print=stdout file.txt
stash push --print=stderr file.txtstash tee always stores input and forwards it to stdout:
some-command | stash tee | next-command
some-command | stash tee --print=stderr | next-command
some-command | stash tee --save-on-error=false | next-command--print controls where the generated entry ID is emitted:
--print=stdoutor--print=1--print=stderror--print=2--print=nullor--print=0
Notes:
- default is
--print=null - bare
stashuses the same--printflag and passes it through to the implicitpushorteemode it selects stash teedefaults to--save-on-error=true--save-on-error=falsedisables saving interrupted input such asCtrl-C- downstream broken pipes are treated as normal exits
- when a broken pipe happens after input was captured,
stash teekeeps the saved entry
Show all stored entry fields:
stash attr wpc43xd3
stash attr 01kn2ahqhr738w84t3wpc43xd3This prints reserved fields such as id, ts, and size, plus any
user-defined attributes.
Read a single field:
stash attr @1 sourceSet attributes:
stash attr @1 source=usgs stage=raw
stash attr @1 --unset stageReserved fields such as id, ts, and size are read-only. Other
attributes are writable directly with key=value and removable with
--unset.
Read multiple fields:
stash attr @1 source stageUse --json to print the full flat attribute object:
stash attr @1 --jsonUse --separator to change the delimiter in the default text output:
stash attr @1 --separator='='List attribute keys seen across the stash:
stash attrs
stash attrs <key>
stash attrs --count
stash attrs <key> --countNotes:
stash attrsprints one attribute key per linestash attrs --countprintskey<TAB>countstash attrs <key>prints distinct values for that attribute, one per linestash attrs <key> --countprintsvalue<TAB>count- this command lists user-defined attribute keys stored in entry attrs
- use
stash ls -a keyto see matching entries - use
stash attr <ref>to inspect the attributes of one specific entry
stash ls prints entry identifiers only:
stash ls
stash ls --id=full
stash ls --id=posAdd columns explicitly:
stash ls -A
stash ls --date
stash ls --size
stash ls --name
stash ls --preview
stash ls --headers --date --size
stash ls --json
stash ls --size=bytes --name
stash ls -a +source -a +stage
stash ls -a source -a +source--long is shorthand for --date --size --attrs=flag --preview:
stash ls -lNotes:
--datedefaults tolsif no value is given--sizedefaults tohumanif no value is given--dateacceptsiso,ago, orls--sizeacceptshumanorbytes--headersprints a header row for tabular output-Aand--attrs=listshow attribute values inline--attrs=countshows a per-entry count of user-defined attrs--attrs=flagshows*when an entry has one or more user attrs-a namefilters to entries where the attribute is set-a name=valuefilters to entries where the attribute equals that value-a +nameselects an attribute for display-a ++nameis shorthand for-a name -a +name-a ++name=valueis shorthand for-a name=value -a +name--id=short|full|poscontrols the first column in all modes
JSON output mirrors the rich listing view:
stash ls --json
stash ls --json -n 1
stash ls --json -a kind
stash ls -a ++kind
stash ls -a ++kind=sampleEach JSON entry includes:
idshort_idstack_reftsdatesizesize_human- flattened attributes
preview
Use stash path to print data or attribute file paths:
stash path @1
stash path -a @1
stash path -d @1
stash ls | stash pathNotes:
- default with a ref: data file path
-a/--attrwith a ref: attribute file path-d/--dirwith a ref: containing directory- with no ref:
- default:
STASH_DIR/data -a:STASH_DIR/attr-d:STASH_DIR
- default:
Remove one entry directly:
stash rm @1
stash rm yjvyz3sf
stash rm @1 @3 yjvyz3sfRemove older entries:
stash rm --before @10
stash rm --after @10Remove entries by attribute match:
stash rm -a source
stash rm -a source=usgs
stash rm -a source=usgs -a stage=rawNotes:
-a namematches entries where the attribute is set-a name=valuematches entries where the attribute equals that value--before <ref>removes entries older than the referenced entry--after <ref>removes entries newer than the referenced entry- multiple
-a/--attrfilters use AND semantics stash rm -a ...shows the matching entries and asks for confirmation unless-fis used
Each entry stores raw data in ~/.stash/data/<ulid> and attributes in
~/.stash/attr/<ulid>.
Current fields include:
idtssizepreview- user-defined attributes such as
filename,source, orlabel
Attribute files contain flat key=value lines. Reserved keys are read-only;
other keys come from -a/--attr key=value, filename when the entry was
created from a file path, and other user-managed attributes.
Entries live under:
~/.stash/
data/<ulid>
attr/<ulid>
cache/
tmp/
When STASH_DIR is set, that directory becomes the stash root instead.
Data is stored exactly as received.