Make ~/.bash_history
or ~/.zsh_history
tidy by filtering out unwanted history lines.
- Compile
unmetafy.c
intounmetafy
bymake
. - Put the following code to a shell script (called
tidy.sh
here):
mv ~/.zsh_history ~/.zsh_history.bak
python3 /absolute/path/to/tidy_sh_history.py ~/.zsh_history.bak ~/.zsh_history /whatever/path/to/log_output.log
or the following if using bash
:
mv ~/.bash_history ~/.bash_history.bak
python3 /absolute/path/to/tidy_sh_history.py ~/.bash_history.bak ~/.bash_history /whatever/path/to/log_output.log
- In
crontab -e
add:
@hourly /bin/sh /absolute/path/to/tidy.sh