Documentation

Installation, shell setup, commands, and configuration.

Installation

One-liner (macOS and Linux):

curl -fsSL oops-cli.com/install.sh | bash

From source (requires Go):

git clone https://github.com/gedaliahs/oops.git cd oops && go build -o oops . sudo mv oops /usr/local/bin/

Shell setup

Add one of these to your shell config, then restart:

# zsh (~/.zshrc) eval "$(oops init zsh)" # bash (~/.bashrc) eval "$(oops init bash)" # fish (~/.config/fish/config.fish) oops init fish | source

Run oops doctor to verify.

Usage

# undo last action oops # undo second-to-last oops 2 # undo third oops 3

Commands

oops

Undo the last destructive action. Pass a number to go further back.

oops log

Show undo history. -n 50 for more.

oops size

Show backup disk usage.

oops clean

Remove old backups. --all for everything, --older-than 3 for entries older than 3 days.

oops config

View or set settings:

oops config # show all oops config retention_days 14 # keep 14 days oops config risk_warning false # disable warnings

oops doctor

Health check — verifies directory, config, git, and hook.

oops init <shell>

Print the hook for zsh, bash, or fish.

oops tutorial

Interactive walkthrough — creates a test file, deletes it, and restores it to show you how oops works.

oops --upgrade

Upgrade to the latest version by re-running the installer.

oops --version

Print the installed version.

Configuration

Stored in ~/.oops/config.json:

  • retention_days — days to keep backups (default: 7)
  • max_trash_bytes — max trash size (default: 5 GB)
  • risk_warning — warn on high-risk commands (default: true)

Storage

~/.oops/ config.json # settings journal.jsonl # action log trash/ 20260315-143022-a1b2/ manifest.json # metadata files/ # backed up files

Auto-cleanup runs lazily, at most once per hour. Old entries get purged. If trash exceeds the max, oldest go first.

How it works

Shell hook — a preexec function pattern-matches your command. Safe commands (ls, cat, git log, etc.) pass through with zero overhead — no subprocess is spawned.

Protect — for destructive commands, oops parses the command string, identifies the target files, and backs them up to ~/.oops/trash/. Then the original command runs normally.

Undo — reads the journal, restores files to their original paths. For git ops, applies the stash or recreates the deleted branch.

How backups work

oops uses hard links instead of copying files. A hard link creates a second reference to the same data on disk — it's instant and uses no extra space. When the original file is deleted by rm, the data survives through the hard link in trash.

This means backing up a 10GB directory takes the same time as a 10KB file: essentially zero. The disk space is only consumed after the original is deleted, since the data now only has one reference (the trash link) instead of two.

Hard links only work on the same filesystem. If oops detects a cross-filesystem backup (e.g. an external drive), it falls back to a regular copy.

When you run oops to restore, the files are linked back to their original paths — also instant.

Uninstall

oops uninstall

Walks you through removing the shell hook, backup directory, and binary with y/n prompts.