How to Use Hstr Command History Browser in Linux

4

This article will quilt a information on the use of the “hstr” command line application that can be utilized to handle, set up, browse and navigate command historical past of bash and zsh shells. It is extra complex than the “history” command to be had in all primary Linux distributions through default and contours a large number of further options.

Main Features of Hstr Command Line Tool

Hstr command will also be configured to supply seek tips whilst typing, very similar to tips you generally see in a internet browser and different packages that includes auto-completion and fuzzy seek. It additionally predicts your command utilization patterns and suggests your ceaselessly used instructions extra incessantly and assists in keeping them at best. You too can manually upload instructions to favorites or upload them as bookmarks for simple and fast get admission to. Other major options of Hstr come with skill to take away instructions from historical past, integrated keyboard shortcuts, coloured output, reinforce for regex patterns, and so forth.

Installing Hstr in Linux

You can set up Hstr in Ubuntu the use of the command discussed underneath:

You would possibly discover a extra up-to-date model of Hstr for Ubuntu within the legit PPA repository supplied through builders of the Hstr command line application. To set up Hstr from the PPA repository, apply directions to be had right here.

Hstr could also be to be had in default repositories of alternative Linux distributions, so you’ll attempt to set up it from the bundle supervisor. Installable applications for greater than 15 Linux distributions and additional set up directions are to be had right here.

Using Hstr Command

To use Htsr command line application, simply sort the next command in a terminal emulator:

Depending for your bash or zsh command line historical past, you must see some output very similar to this:

te the historical past entries the use of arrow keys and hit key to select the highlighted command within the historical past. The effects underneath the white bar will exchange as you sort, appearing you most effective related instructions to be had within the historical past matching the entered characters. The white bar additionally presentations you sure keyboard shortcuts that can be utilized to modify view sort. For example, you’ll transfer between favorites, ceaselessly used, and up to date effects through urgent key.

You can go out the historical past view anytime through urgent key. To view most effective favorites through default, you’ll run the next command:

To view command historical past in a non-interactive approach, run the next command:

Adding a Command to Favorites

You can upload a command to favorites for simple get admission to through urgent key whilst a command is highlighted. You gets a message within the terminal indicating {that a} command has been effectively added to the favorites record.

how to use hstr command history browser in linux How to Use Hstr Command History Browser in Linux 1638760164 631 How to Use Hstr Command History Browser in Linux

You can view favorites through urgent key a couple of instances till the record of favorites seems below the white bar.

how to use hstr command history browser in linux How to Use Hstr Command History Browser in Linux 1638760165 666 How to Use Hstr Command History Browser in Linux

Configuring Hstr Command

You can view optimized configuration settings for many use circumstances through operating the next command:

$ hstr –show-configuration

how to use hstr command history browser in linux How to Use Hstr Command History Browser in Linux 1638760166 350 How to Use Hstr Command History Browser in Linux

The configuration unload is self-explanatory and smartly commented, you’ll know extra about each and every configuration parameter through studying its respective remark. These optimized settings aren’t enabled through default, it is important to upload them to the “$HOME/.bashrc” record. To accomplish that, run the next two instructions:

$ hstr –show-configuration >> “$HOME/.bashrc”
$ supply “$HOME/.bashrc”

Once those settings are stored to the bashrc record, it is possible for you to to make use of keyboard shortcut to at once invoke hstr command from a terminal emulator.

These settings must be sufficient for many use circumstances. However, in the event you additional need to tweak configuration of the hstr command, use this detailed information to be had at the legit Hstr wiki. This information additionally comprises helpful examples and configuration presets that you’ll installed bashrc or zshrc recordsdata.

Blacklisting Certain Commands from Appearing in Hstr Results

Blacklisting serve as is disabled through default in Hstr. To permit it, upload the next line to “$HOME/.bashrc” record:

export HSTR_CONFIG=blacklist

If the HSTR_CONFIG surroundings variable already has a worth assigned to it, you’ll upload extra values at the proper hand aspect through the use of the comma image as delimiter. After including the above line, run the next command to use the adjustments made to the bashrc record:

Now that blacklisting is enabled, you’ll upload instructions to the “$HOME/.hstr_blacklist” record to blacklist them. The blacklist record must comprise one command in line with line.

Conclusion

Hstr command supplies many beneficial options over the vintage historical past command to be had in maximum Linux distributions. Not most effective it makes surfing command line historical past extra consumer pleasant, it additionally permits you to disguise delicate instructions through including them to blacklist.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More