Create files and directories in one command.
puravida is a tiny Bash script that replaces mkdir -p, touch, and here-documents. Parent directories are created as needed.
brew install mark-mcdermott/tap/puravida
Two commands, or one.
Every example on this page is pulled from the CLI's own README at v2.1.1, so the site can't drift from the tool.
A file in a folder that does not exist yet
Multi-line content, without the here-doc
See it run.
The whole feature tour — files and directories, many paths at once, inline and multi-line content, and the -f flag.
Every form.
A dot in the final path segment makes a file, no dot makes a directory. A trailing slash always wins, and -f forces a dotless name to be a file.
| Command | Creates |
|---|---|
| puravida notes.txt | file notes.txt |
| puravida notes | directory notes/ |
| puravida src/app.js | src/ + file app.js |
| puravida a.txt b.txt | files a.txt and b.txt |
| puravida assets/ | empty directory assets/ |
| puravida my.dir/ | directory my.dir/ — trailing / beats the dot |
| puravida -f Makefile | file Makefile — -f forces a dotless file |
| puravida logs/api.v2/x.txt | logs/ + api.v2/ dirs + file x.txt |
| puravida docs/ intro.md api.md | docs/ containing intro.md and api.md |
| puravida .claude/ settings.json cmds/x.md | .claude/ with settings.json and cmds/x.md |
| puravida notes.txt ~~ hello world | notes.txt containing hello world |
| puravida a.txt b.txt ~~ hi | a.txt empty, b.txt containing hi |
| puravida notes.txt ~ | notes.txt from multi-line input (ends on a lone ~) |
Options
-f,--file- Treat dotless names as files (e.g.
Makefile,LICENSE) -h,--help- Show usage and exit
--version- Show the version and exit
Exit status
- 0
- Success
- 1
- A runtime error (e.g. a file or directory could not be created)
- 2
- A usage error (no arguments, an unknown option, or
~~with no preceding file)
Install it.
Runs on macOS and Linux. Multi-line mode uses portable sed, and CI exercises the suite on both.
Homebrew
Then brew upgrade puravida updates it.
brew install mark-mcdermott/tap/puravidaFrom source, per user
Installs under ~/.local — no sudo. Make sure ~/.local/bin is on your PATH.
The pv shortcut
Symlinks a two-letter pv alongside the install. Note it shadows the pipe viewer if you have that.
make install-pv