diethist #
sqlite-backed shell history with fuzzy ctrl-r search, for bash, fish and zsh.
Your shell history on a diet: a much smaller atuin with just the session-agnostic history and the search TUI.
Inspired by stinkpot, a similarly tiny Go take on the same idea.
install #
Try it without installing:
nix run github:nagasrinath/diethist
script (linux, macOS) #
curl -fsSL https://raw.githubusercontent.com/nagasrinath/diethist/main/install.sh | bash
This installs the latest release binary into ~/.local/share/bin, adds it to
your PATH, and wires up the shell integration. Restart your shell, or run the
activation line the script prints to use it right away. A specific version can
be installed with install.sh v0.1.2. The install directory can be
overridden with DIETHIST_INSTALL_DIR.
nix #
Add the input:
inputs.diethist.url = "github:nagasrinath/diethist";
Then either take the package directly:
{
environment.systemPackages = [inputs.diethist.packages.${pkgs.system}.default];
}
or bring in the overlay and use pkgs.diethist:
{
nixpkgs.overlays = [inputs.diethist.overlays.default];
environment.systemPackages = [pkgs.diethist];
}
nix-darwin #
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nix-darwin.url = "github:nix-darwin/nix-darwin";
diethist.url = "github:nagasrinath/diethist";
};
outputs = {
nixpkgs,
nix-darwin,
diethist,
...
}: {
darwinConfigurations."your-host" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
({pkgs, ...}: {
nixpkgs.overlays = [diethist.overlays.default];
environment.systemPackages = [pkgs.diethist];
})
];
};
};
}
home-manager #
The module installs diethist and wires up the shell integration. It works the
same under nix-darwin, via home-manager.darwinModules.home-manager.
{
imports = [inputs.diethist.homeManagerModules.default];
programs.diethist = {
enable = true;
enableFishIntegration = true; # or enableBashIntegration
};
}
There is no zsh option yet; add the zsh line below by hand.
setup #
Without home-manager, add one line to your shell config:
eval "$(diethist init)" # ~/.bashrc
diethist init fish | source # ~/.config/fish/config.fish
eval "$(diethist init zsh)" # ~/.zshrc
usage #
Seed the database from your existing history. The format is detected from the
file, or picked from $SHELL:
diethist import
diethist import --file ~/.local/share/fish/fish_history
diethist import --shell fish
Re-importing is safe: a command already stored keeps whichever timestamp is newer.
Then hit ctrl-r:
> search history...
1s vim flake.nix
3m redis-server
35m jj show m
788 matches · ↑/↓ move · enter accept · esc cancel
tab/enter accepts the selection, esc cancels, ↑/↓ move.
See the last 50 recorded commands without the TUI:
diethist list
uninstall #
rm "${DIETHIST_INSTALL_DIR:-$HOME/.local/share/bin}/diethist"
rm -rf ~/.local/share/diethist # database
Then remove the lines install.sh added to your shell config — look for the
# diethist shell integration marker comment in ~/.bashrc, ~/.zshrc, or
~/.config/fish/config.fish.
troubleshooting #
The database is at ~/.local/share/diethist/history.db. If an upgrade ever
breaks it, delete it and run diethist import again — re-importing is safe
(see usage).
build #
cargo build --release
cargo test