Skip to content
puravida.shGitHub

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
Other ways to installmacOS and LinuxMIT licensed
A low-poly isometric island: stilt houses climbing a hillside above a cube of ocean, with a toucan and the word puravida overhead.
bash
the usual way
mkdir -p folder
echo "hi" > folder/file.txt
with puravida
puravida folder/file.txt ~~ hi

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

bash
mkdir -p folder
echo "hi" > folder/file.txt
puravida folder/file.txt ~~ hi

Multi-line content, without the here-doc

bash
mkdir -p folder
cat > folder/file.txt << 'END'
first line
second line
END
puravida folder/file.txt ~
first line
second line
~

See it run.

The whole feature tour — files and directories, many paths at once, inline and multi-line content, and the -f flag.

There is a longer, narrated walkthrough on YouTube.

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.

CommandCreates
puravida notes.txtfile notes.txt
puravida notesdirectory notes/
puravida src/app.jssrc/ + file app.js
puravida a.txt b.txtfiles a.txt and b.txt
puravida assets/empty directory assets/
puravida my.dir/directory my.dir/ — trailing / beats the dot
puravida -f Makefilefile Makefile-f forces a dotless file
puravida logs/api.v2/x.txtlogs/ + api.v2/ dirs + file x.txt
puravida docs/ intro.md api.mddocs/ 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 worldnotes.txt containing hello world
puravida a.txt b.txt ~~ hia.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/puravida

From source, per user

Installs under ~/.local — no sudo. Make sure ~/.local/bin is on your PATH.

bash
git clone https://github.com/mark-mcdermott/puravida.git
cd puravida
make install-user

The pv shortcut

Symlinks a two-letter pv alongside the install. Note it shadows the pipe viewer if you have that.

make install-pv