No description
Find a file
2025-07-10 00:45:27 -04:00
src bash why 2025-07-10 00:45:27 -04:00
.gitignore Initial commit 2025-07-03 23:12:35 -04:00
bhu.toml Add better documentation as well as a regex matcher 2025-07-09 23:26:04 -04:00
Cargo.lock start using Results more and make filtering code more concise 2025-07-10 00:05:56 -04:00
Cargo.toml bash why 2025-07-10 00:45:27 -04:00
LICENSE.md Initial commit 2025-07-03 23:12:35 -04:00
README.md bash why 2025-07-10 00:45:27 -04:00

Bash History Utils

Various utilities to help make your bash history more useful.

Features

  • Bash History Filtering
    • Remove duplicate commands from your bash history
    • Remove commands that you use a lot and don't want cluttering your bash history (such as ls, cd, clear, etc.; which commands you want to delete is configurable!)

Usage

Create a config file ./bhu.toml with the application configuration (there is an example in this repo). You can test how this will affect your Bash history by running:

bash-history-utils clean /path/to/.bash_history

This will by default print the Bash history with your filters applied. If you want to apply this to your Bash history, you can run:

bash-history-utils clean /path/to/.bash_history > ~/.bash_history

Note that this will overwrite your bash history file.

Automatically Run

You can make this application run automatically when starting a shell by appending the following to your ~/.bashrc:

bash-history-utils clean /path/to/.bash_history > ~/.bash_history

This snippet makes the following assumptions:

  • The bash-history-utils executable is on your $PATH.
  • The config file ~/bhu.toml exists. You can change this path by adding the flag -f /path/to/bhu.toml.

Roadmap

Milestone 1

  • history cleanup thing you can manually run / execute as a cronjob/systemd timer/bashrc command
  • remove commands based on your filters
    • command names such as ls, clear
    • commands with specific flags (ls -l)
    • duplicate commands

Milestone 2

  • start working on rich history stuff
    • keeping track of cwd
  • integrate with bash somehow to grab command metadata (env vars, working directory, etc.)
  • make a cli search tool for rich history or integrate into an existing one

Milestone 3

  • more rich history metadata
    • customized env vars
    • nix shell params if available
    • output files
  • make search tool able to replicate environment,
  • maybe integrate search tool into fzf?

Milestone 4

(this one is probably useless so maybe never)

  • cross-host shell history
    • sync history over SSH connections
    • reconnect to remote hosts for reloading commands

License

This program is licensed under the GNU General Public License, Version 3.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.