How To Install hstr on Ubuntu 22.04

In this tutorial we learn how to install hstr on Ubuntu 22.04. hstr is Suggest box like shell history completion

Introduction

In this tutorial we learn how to install hstr on Ubuntu 22.04.

What is hstr

hstr is:

Command line tool that brings improved bash/zsh command completion from the history. It aims to make completion easier and more efficient than Ctrl-r.

HSTR can also manage your command history (for instance you can remove commands that are obsolete or contain a piece of sensitive information) or bookmark your favorite commands.

There are three methods to install hstr on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install hstr Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install hstr using apt-get by running the following command:

sudo apt-get -y install hstr

Install hstr Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install hstr using apt by running the following command:

sudo apt -y install hstr

Install hstr Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install hstr using aptitude by running the following command:

sudo aptitude -y install hstr

How To Uninstall hstr on Ubuntu 22.04

To uninstall only the hstr package we can use the following command:

sudo apt-get remove hstr

Uninstall hstr And Its Dependencies

To uninstall hstr and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove hstr

Remove hstr Configurations and Data

To remove hstr configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge hstr

Remove hstr configuration, data, and all of its dependencies

We can use the following command to remove hstr configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge hstr

References

Summary

In this tutorial we learn how to install hstr package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.