HSTR – Easily View, Navigate, Search And Manage Your Commandline History

hstr - Manage Your Commandline History

Are you looking for a way to find the recently used commands? Are you sick of typing some long commands over and over despite you used them recently? Are you want to mange and bookmark the favorite and frequently used commands in the SHELL? Well, look nowhere. Meet HSTR – a free and open source utility to view, navigate, search and use your command history. Of course, you can search the your command history using up/down arrow keys or using CTRL-R and type the search term to find a recently used command in the history. However, Hstr is much more easier than CTRL-R. Read on, you will find out.

HSTR – Easily View, Navigate, Search And Manage Your Commandline History

Installing HSTR

For Arch Linux and its derivatives, Hstr is available in AUR. So, the Arch users can install it using any AUR helper tools such as Pacaur, Packer, and Yaourt etc.

pacaur -S hstr-git


packer -S hstr-git


yaourt -S hstr-git

CentOS and RHEL users can install it using command:

sudo yum install hstr

The Debian users can install it as shown below.

First, Download and register the key using commands:

wget www.clfh.de/frankh.asc
sudo apt-key add frankh.asc

Then, add the following lines in the sources list:

deb http://www.clfh.de/debian wheezy main
deb-src http://www.clfh.de/debian wheezy main

Finally, update the sources list and install hstr using command:

sudo apt-get update
sudo apt-get install hh

Fedora users install it with following command:

sudo dnf install hstr

openSUSE Leap 42.1 users run the following as root user to install hstr:

zypper addrepo http://download.opensuse.org/repositories/home:tuw-e184/openSUSE_Leap_42.1/home:tuw-e184.repo
zypper refresh
zypper install hstr

The Ubuntu and Linux Mint users can install it using Hstr official PPA.

sudo add-apt-repository ppa:ultradvorka/ppa
sudo apt-get update
sudo apt-get install hh

The other Linux distribution users can install it from source as shown below.

Switch to root user and clone HSTR Git repository with command:

git clone https://github.com/dvorka/hstr.git

Create build files using:

cd ./dist && ./1-dist.sh && cd ..

Finally, Install hh using commands:

./configure && make && make install

Configure HSTR

After installing hstr, run the following command to configure it with BASH.

hh --show-configuration >> ~/.bashrc

Run the following command to apply the changes.

source ~/.bashrc

It’s just enough to get going.

For detailed hh configuration documentation, head over to the Configuration page.


To search for the commands in the history, type hstr or hh in the Terminal and hit ENTER.

hstr provides suggest box like functionality for commands used in the past. Type any letter in the prompt, hstr will automatically suggests a list of commands that contains the letter. Use Up/Down arrows to navigate through the history.

You can also directly specify the search patterns along with hh or hstr command in the Terminal. For instance, type the following command to search for commands that has pattern “git”.

hh git


hstr git

You will see the list of suggestions once you hit ENTER key.

To select a command and bring it to the Terminal, use TAB key. Or, choose the command hit ENTER key to directly execute it.

By default, Hstr parses your .bash-history file that is filtered as you type a command substring. Commands are not just filtered, but also ordered by a ranking algorithm that considers number of occurrences, length and timestamp.

To delete a command from the history file, select it and hit DEL key.

hstr has bookmarking feature. So, you can bookmark your favorite and frequently used commands. To bookmark your favorite command, select the command from the list using up/down arrows, press CTRL-F. The selected command will be marked as favorite.

All bookmarked commands will be saved in ~/.hh_favorites file. To view the bookmarked commands, type CTRL-/ (Control key + / (forward slash)) keys.

To exit from hstr and go back to Terminal, press CTRL-g.

Complete list of keys

Here is the complete list of key bindings to use HSTR effectively.

  • Ctrl-e : Toggle regular expression and substring search.
  • Ctrl-t : Toggle case sensitive search.
  • Ctrl-/, Ctrl-7 : Rotate view of history as provided by Bash, ranked history ordered by the number of occurences/length/timestamp and favorites.
  • Ctrl-f : Add currently selected command to favorites.
  • Ctrl-l : Make search pattern lowercase or uppercase.
  • Ctrl-r, UP/DOWN arrows, Ctrl-n, Ctrl-p : Navigate in the history list.
  • TAB, RIGHT arrow : Choose currently selected item for completion and let user to edit it on the command prompt.
  • LEFT arrow : Choose currently selected item for completion and let user to edit it in editor (fix command).
  • ENTER : Choose currently selected item for completion and execute it.
  • DEL : Remove currently selected item from the shell history.
  • BACSKSPACE, Ctrl-h : Delete last pattern character.
  • Ctrl-u, Ctrl-w : Delete pattern and search again.
  • Ctrl-x : Write changes to shell history and exit.
  • Ctrl-g : Exit with empty prompt.

For more details, check the man pages.

man hh

And, that’s all for now folks. Hope this helps. If you find our guides useful, please spend a moment to share them on your social, professional networks and support OSTechNix!



Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.