Terminal undo on Linux
May 2026
Linux shells can recall commands, edit lines, and stop processes. They do not provide a general undo for filesystem changes caused by rm, mv, git reset --hard, or redirects.
What undo needs
Real terminal undo needs a copy from before the destructive command. For tracked files, git can help. For untracked files, generated assets, local notes, and config, you need a local backup before the command runs.
How oops works on Linux
oops installs shell hooks for bash, zsh, and fish. The hook detects destructive commands, backs up the target files to ~/.oops/trash/, and records metadata for restore.
Cleanup and disk usage
Backups auto-clean after the configured retention window and respect the max trash size. On Linux, oops cleanup-service install can install a user-level systemd timer for hourly cleanup.
Install
After installing, run oops doctor to verify the shell hook. For macOS specifics, read terminal undo on Mac.