A small, cross-platform Go CLI for backing up your current working directory and quickly jumping between the original location and its backup.
bkup is designed to be:
- Simple – one binary, no config required
- Cross-platform – works on macOS, Linux, and Windows
- Safe by default – backups live in a single, predictable location under your home directory
- 📦 One-command backup of the current directory and all subfiles
- ♻️ Overwrite-safe – existing backups with the same name are replaced
- 🚀 Quick navigation into the backup via a subshell
- 🔙 Revert support – jump back to where you started
- 🧭 Shell-friendly mode for true
cdintegration
- All backups are stored in:
$HOME/.bkup/
- When you back up a directory named
vii, it is copied to:
$HOME/.bkup/vii_backup/
- When using
bkup go, your original directory is saved to:
$HOME/.bkup/prev.txt
This allows bkup revert to take you back later.
go build -o bkup .Move it somewhere on your PATH:
# macOS / Linux
sudo mv bkup /usr/local/bin/bkupOn Windows, place bkup.exe somewhere in your %PATH%.
bkupExample:
cd /src/vii
bkup
# → creates $HOME/.bkup/vii_backupbkup goThis will:
- Back up the current directory
- Save the original location to
prev.txt - Open a subshell inside the backup directory
Exit the shell to return to where you ran the command.
bkup revertThis opens a subshell in the directory saved by the last bkup go.
⚠️ You must runbkup goat least once before usingbkup revert.
Because a program cannot permanently change your current shell’s working directory, bkup provides a --print mode so you can wrap it with shell functions.
Add this to your ~/.bashrc or ~/.zshrc:
bkupgo() {
cd "$(bkup go --print)"
}
bkuprv() {
cd "$(bkup revert --print)"
}Now you get true cd behavior:
bkupgo # cd into backup directory
bkuprv # cd back to original directory- Backups overwrite existing directories with the same name
- File permissions and modification times are preserved best-effort
- Symlinks are preserved as symlinks
- No compression is used (this is a straight file copy)
~/.bkup/
├── vii_backup/
│ ├── main.go
│ ├── go.mod
│ └── ...
└── prev.txt
MIT License © 2025
bkup is ideal for:
- Quick safety snapshots before refactors
- Experimenting without Git commits
- Jumping into backup copies instantly
- A lightweight alternative to full backup tools
If you want extensions like compression, timestamps, or multiple backup histories, this tool is intentionally small and easy to modify.
Happy hacking 🚀