DEV Community

Cover image for How to Interactively Retrieve Terminal History
Marcos Oliveira
Marcos Oliveira

Posted on

How to Interactively Retrieve Terminal History

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
Enter fullscreen mode Exit fullscreen mode

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\"
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

๐Ÿƒ Running

๐Ÿ‚ On GNU/Linux

๐ŸชŸ On Windows


๐Ÿ“น Video tutorial showing step by step how the his command was made.

https://youtu.be/gILIsK3MiGQ

Top comments (0)