How to Interactively Retrieve Terminal History



This content originally appeared on DEV Community and was authored by Marcos Oliveira

his is a command history utility with icons and colors that works on Windows and GNU/Linux.

📦 Dependencies

🪟 Windows

🐂 GNU/Linux

Example using APT:

sudo apt install build-essential cmake libncurses-dev git

The fonts need to be installed manually as per the link above.

🚧 Build

🪟 Windows

PowerShell

git clone https://github.com/terroo/his
Set-Location his
g++ -I C:\mingw64\include main.cpp his.cpp C:\mingw64\lib\pdcurses.a -o his
New-Item -Path "C:\His\bin" -ItemType Directory
Move-Item .\his.exe -Destination "C:\His\bin\"

You can now exit the cloned directory and remove it.

Create an environment variable for your user

[System.Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\His\bin", [System.EnvironmentVariableTarget]::User)

Close and open the terminal and test: his --version

🐂 GNU/Linux

git clone https://github.com/terroo/his
cd his
cmake . -B build
cmake --build build
sudo cmake --install build

You can now exit the cloned directory and remove it: cd .. && rm -rf his/. And test: his --version

💼 Usage

After SELECTING the top command, press ENTER to run it via his

his --help

Usage:
his [options]

Options:
  --match-start,   -m  Match only the exact command.
  --no-show-icons, -n  No displays icons.
  --help,          -h  Show this message.
  --version,       -v  Show version info.

🏃 Running

🐂 On GNU/Linux

🪟 On Windows

📹 Video tutorial showing step by step how the his command was made.

https://youtu.be/gILIsK3MiGQ


This content originally appeared on DEV Community and was authored by Marcos Oliveira