Improved version of the 'history' command
This script gives a friendlier access CLI or GUI (with rofi
) to the user’s shell history.
The user can select a previous command and it will be put in the clipboard’s buffer using xclip
.
The user can then paste the command using Ctrl + Shift + v in the terminal. (Or use the rofi
options to automatically run it)
Especially useful when you try to recover a long command you used a long time ago.
This script do not change the history file and should work in all situations. Or a least will.
From a terminal emulator, it is supposed to be launched with a simple “h what_ever_you_want”
Thanks to an alias : alias h="/path/to/this/script"
(in “.bashrc” file, “.zshrc”, etc…)
If you remember that the command contain the word “debug”, you can use “h debug” to find it back quickly.
Works better with a big history record :export HISTSIZE=10000
(in “.bashrc” file, “.zshrc”, etc…)
Use rofi
interface with a shortcut for your window manager. (Alt + h)
alt + h
/home/umen/SyNc/Scripts/System/better_history/better_history.sh rofi
<keybind key="A-h">
<action name="execute">
<command>/home/umen/SyNc/Scripts/System/better_history/better_history.sh rofi</command>
</action>
</keybind>
~/.my_history_selection
to sort by most used command, instead of last used commands(sed 's/.*:0;//')
rofi
with options --rofi
instead of argument$SHELL