Skip to content

Commit

Permalink
Initial HSTR version which works w/o TIOCSTI #478
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorka committed Apr 15, 2023
1 parent 83e7d6c commit 2665ea6
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 63 deletions.
6 changes: 3 additions & 3 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2023-04-02 Martin Dvorak <[email protected]>
2023-04-10 Martin Dvorak <[email protected]>

* Released v3.0.0 - important fix release ensuring that HSTR will work
on operating systems and Linux kernels without TIOCSTI support.
* Released v3.0.0 - important release which adds ability of HSTR to work
on operating systems and Linux kernels without ioctl/TIOCSTI support.

2022-12-11 Martin Dvorak <[email protected]>

Expand Down
75 changes: 68 additions & 7 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Installation

Install:

* [Ubuntu](#ubuntu)
Expand Down Expand Up @@ -37,13 +38,17 @@ Tarball:

Upgrade:

* [HSTR 1.x to 2.x](#upgrade)
* [HSTR 1.x to 2.x](#hstr-1-x-to-2-x--from-hh-to-hstr)
* [HSTR 2.x to 3.x](#hstr-2-x-to-3-x--ioctl---tiocsti)
# Install

Install HSTR using a [package](https://pkgs.org/search/?q=hstr) or repository.

## Ubuntu

HSTR is [included in Ubuntu 21.10](https://packages.ubuntu.com/search?keywords=hstr) and [newer](https://wiki.ubuntu.com/Releases) releases:

```
```bash
sudo apt install hstr
```

Expand All @@ -66,9 +71,10 @@ sudo apt-get install hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Debian/Mint

HSTR is [included in Debian 11](https://packages.debian.org/bullseye/hstr) and [newer](https://www.debian.org/releases/) releases:

```
```bash
sudo apt install hstr
```

Expand Down Expand Up @@ -107,13 +113,14 @@ apt-get install libncursesw5 libtinfo5
sudo dpkg -i hstr.deb
```


## Fedora/RHEL/CentOS/Scientific

Install HSTR on [Fedora](https://src.fedoraproject.org/rpms/hstr), RHEL, CentOS or Scientific Linux:

```bash
sudo dnf install hstr
```

... or:

```bash
Expand All @@ -132,6 +139,7 @@ sudo dnf install ./hstr-<major>.<minor>.<revision>-2.x86_64.rpm
```

## openSUSE

To install HSTR on openSUSE, please check [software.opensuse.org](https://software.opensuse.org/package/hstr) or [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:

```bash
Expand All @@ -141,7 +149,9 @@ zypper install hstr
```

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Gentoo

To install HSTR on Gentoo run (HSTR has been added to [Portage](https://bugs.gentoo.org/show_bug.cgi?id=527122)):

```bash
Expand All @@ -161,6 +171,7 @@ apk add hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## ALT Linux

To install HSTR on ALT Linux, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:

```bash
Expand All @@ -173,38 +184,47 @@ sudo apt-get install hstr
```

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Arch/Manjaro Linux

To install HSTR on Arch or Manjaro Linux download the latest distribution either from [pkgs.org](https://pkgs.org/search/?q=hstr) or [GitHub releases](https://github.com/dvorka/hstr/releases).

Use [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) in the root of the distribution to build package using `makepkg`.

To install HSTR from the [Arch User Repository (AUR)](https://aur.archlinux.org/packages/hstr-git/) run `yaourt -S hstr-git` in command line.

## FreeBSD

To install HSTR on FreeBSD, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:

```bash
pkg install hstr
```

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Slackware

To install HSTR on Slackware, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:

```bash
upgradepkg --install-new hstr-<major>.<minor>-x86_64-1cf.txz
```

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Void Linux

To install HSTR on Void Linux, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows:

```bash
xbps-install -Su hstr
```

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Milis Linux

To install HSTR on Milis Linux run the following commands as root:

```bash
Expand All @@ -214,12 +234,15 @@ mps kur hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Haiku OS

To install HSTR on Haiku OS use [Haiku Depot](https://www.haiku-os.org/docs/userguide/en/applications/haikudepot.html):

* https://depot.haiku-os.org/#!/?srchexpr=hstr

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## macOS

Install HSTR on macOS using [Homebrew](https://brew.sh/) ([formula](https://formulae.brew.sh/formula/hstr)):

```bash
Expand All @@ -235,6 +258,7 @@ sudo port install hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## nix package manager

To install HSTR using the [nix package manager](https://nixos.org/nix/) e.g. on [NixOS](https://nixos.org/) you can use the [nix derivation for HSTR](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hstr/default.nix):

```bash
Expand All @@ -244,6 +268,7 @@ nix-env -i hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Guix package manager

To install HSTR in [GuixSD](https://www.gnu.org/software/guix/) or using the standalone [Guix package manager](https://www.gnu.org/software/guix/manual/en/html_node/Binary-Installation.html#Binary-Installation) you can install the `hstr` package, e.g.

```bash
Expand All @@ -253,6 +278,7 @@ guix package -i hstr
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## MPR package manager

To install HSTR in Ubuntu or derivative operating systems using MPR, you can search for `hstr-git` using helper
or install it manually using `makedeb -s`

Expand All @@ -261,9 +287,11 @@ or install it manually using `makedeb -s`
[MPR package](https://mpr.hunterwittenborn.com/packages/hstr-git)

# Build

Build HSTR from source code.

## Build on any Linux distro

Clone Git repository:

```bash
Expand All @@ -285,6 +313,7 @@ Build and install HSTR using:
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Build snap

To build [snap](https://snapcraft.io/) for HSTR first clone Git repository:

```bash
Expand All @@ -298,7 +327,7 @@ distribution.
Install [snapcraft](https://snapcraft.io/) and build
snap by running snapcraft in the root of Git repository:

```
```bash
$ ls ./snap
snapcraft.yaml
$ snapcraft
Expand All @@ -308,6 +337,7 @@ $ snapcraft
Find `hstr_0+git..._amd64.snap` in the current directory.

## Build on Ubuntu

To build HSTR on Ubuntu clone Git repository:

```bash
Expand All @@ -334,8 +364,8 @@ Build and install HSTR using:

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).


## Build on Debian

To build HSTR on Debian clone Git repository:

```bash
Expand All @@ -360,10 +390,10 @@ Build and install HSTR using:
./configure && make && make install
```


[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Build on Fedora

To build HSTR on Fedora clone Git repository:

```bash
Expand Down Expand Up @@ -391,6 +421,7 @@ Build and install HSTR using:
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Build on WSL

To build HSTR on [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/en-us/commandline/wsl/about) clone Git repository:

```bash
Expand Down Expand Up @@ -428,6 +459,7 @@ Make sure to **run** HSTR using <kbd>Ctrl-r</kbd> (or `hstrwsl`) - otherwise com
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Build on Cygwin

To build HSTR on [Cygwin](https://www.cygwin.com) clone Git repository:

```bash
Expand Down Expand Up @@ -457,7 +489,9 @@ hstr --show-configuration >> ~/.bashrc
Make sure to **run** HSTR using <kbd>Ctrl-r</kbd> (or `hstrcygwin`) - otherwise commands will not appear in prompt.

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

## Build on macOS

HSTR can be built on macOS either using [MacPorts](https://www.macports.org/) or [Homebrew](https://brew.sh/).

---
Expand Down Expand Up @@ -492,9 +526,11 @@ make
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

# Tarball

Download and install HSTR tarball.

## Build and Install Tarball

Download latest tarball from [GitHub releases](https://github.com/dvorka/hstr/releases) section.
Expand the archive and install HSTR using:

Expand All @@ -503,7 +539,32 @@ Expand the archive and install HSTR using:
```

[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

# Upgrade

HSTR major versions upgrades instructions.

## HSTR 1.x to 2.x: from HH to HSTR

Upgrade HSTR using a [package](https://pkgs.org/search/?q=hstr) or repository. If you are `HSTR 1.x` user, please read about [HSTR 2.x changes](https://github.com/dvorka/hstr/releases/tag/2.0).

## HSTR 2.x to 3.x: ioctl / TIOCSTI

`TIOCSTI` is an acronym for "Terminal Input Output Control STack Input",
and it is a system call used in Unix-like operating systems. The `TIOCSTI`
system call allows to insert data into the input buffer of a terminal
as if it had been typed by the user.

`TIOCSTI` is NOT available at:

* Linux kernel >=6.2.0
* Cygwin
* WSL

HSTR uses `TIOCSTI` to insert a command chosen by the user in HSTR
to shell prompt - if `TIOCSTI` is available. Otherwise shell specific
line editors features are used.

**Therefore it is important to configure HSTR after the installation:**

* [HSTR configuration](README.md#configuration)
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# HSTR

[![GitHub Actions CI for Ubuntu](https://github.com/dvorka/hstr/actions/workflows/build_ubuntu.yml/badge.svg)](https://github.com/dvorka/hstr/actions)
[![Current release](https://img.shields.io/github/release/dvorka/hstr.svg)](https://github.com/dvorka/hstr/releases)
[![GitHub issues](https://img.shields.io/github/issues/dvorka/hstr.svg?maxAge=360)](https://github.com/dvorka/hstr/issues)
Expand All @@ -11,23 +12,23 @@ Easily view, navigate and search your **command history** with shell history sug
[![Shell History Suggest Box](doc/hstr-v2.gif "Shell History Suggest Box @ YouTube")](http://www.youtube.com/watch?v=sPF29NyXe2U)

## Description

Are you looking for a command that you used **recently**? Do you
want to avoid the need to write **long commands** over and over
again? Are you looking for a tool that is able to manage your
**favorite** commands?

HSTR (**H**i**ST**o**R**y) is a command line utility that brings improved `bash`/`zsh` command completion
from the history. It aims to make completion **easier** and more **efficient**
than <kbd>Ctrl-r</kbd>.
from the history. It aims to make completion **easier** and more **efficient** than <kbd>Ctrl-r</kbd>.

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.

<!-- Check [video](http://www.youtube.com/watch?v=sPF29NyXe2U) tutorial. -->


## Installation

Install:

* [Ubuntu](INSTALLATION.md#ubuntu)
Expand Down Expand Up @@ -69,8 +70,8 @@ Tarball:

Check also [packages](https://pkgs.org/search/?q=hstr) for Linux and Unix.


## Configuration

Configure HSTR just by running:

```bash
Expand All @@ -80,14 +81,15 @@ hstr --show-configuration >> ~/.bashrc
# zsh
hstr --show-configuration >> ~/.zshrc
```
For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md).

For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md).

## In the News
Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](http://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/).

Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](http://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/).

## Documentation

Check man page:

```bash
Expand All @@ -96,6 +98,6 @@ man hstr

User videos: [Zack](https://www.youtube.com/watch?v=Qd75pIeQkH8), [Dvorka](https://www.youtube.com/watch?v=sPF29NyXe2U) and [Yu-Jie Lin](https://www.youtube.com/watch?v=Qx5n_5B5xUw).


## Bugs

https://github.com/dvorka/hstr/issues
Loading

0 comments on commit 2665ea6

Please sign in to comment.