whatdidi - command line history search tool
View project on GitHubA command-line utility that helps you find commands you've previously run. Searches your shell history (both persistent and current session) and retrieves matching commands based on a search term.
- Compatible with bash and zsh, MacOS and Linux.
- Update and uninstall functionality.
- Comprehensive & automated testing suite.
- Persistent user settings for default count and unique results.
Install
curl -fsSL https://raw.githubusercontent.com/AtlasICL/whatdidi/main/install.sh | sh
Features / Example Usage
Search for the last command you ran:
whatdidi curl
> curl -s https://sh.rustup.rs | sh
Search for the last n commands you ran:
whatdidi mvn 3
> mvn clean compile
> mvn test
> mvn clean compile exec:java "-Dexec.mainClass=simulator.ui.UserCLI"
Supports compound commands (e.g. search for git push specifically):
whatdidi "git push" 2
> git push
> git push -u origin main:refactoring
Supports commands prefixed with sudo:
whatdidi rm 2
> rm foo.txt
> sudo rm bar.txt
Return only unique results with -u / --unique (the flag can go anywhere):
whatdidi -u git
> git push origin main
> git commit -m "feat: performance testing framework"
> git status
Set the default result count (stored in ~/.config/whatdidi/config):
whatdidi --set-default-count 3
Make unique results the default (pass --no-unique to override per search):
whatdidi --set-default-unique true
Update to the latest version, or uninstall:
whatdidi --update
whatdidi --uninstall