Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dkolmakov/hm
Command line history manager for bash
https://github.com/dkolmakov/hm
bash bash-history command-history directory-history history-management history-manager session-history zsh zsh-history
Last synced: about 2 months ago
JSON representation
Command line history manager for bash
- Host: GitHub
- URL: https://github.com/dkolmakov/hm
- Owner: dkolmakov
- License: apache-2.0
- Created: 2019-09-04T15:52:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-11T18:32:23.000Z (almost 2 years ago)
- Last Synced: 2024-09-15T01:48:11.310Z (3 months ago)
- Topics: bash, bash-history, command-history, directory-history, history-management, history-manager, session-history, zsh, zsh-history
- Language: C++
- Homepage:
- Size: 2.3 MB
- Stars: 28
- Watchers: 5
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Build Status](https://github.com/dkolmakov/hm/actions/workflows/build-and-test.yml/badge.svg)
![Code Style](https://github.com/dkolmakov/hm/actions/workflows/code-style.yml/badge.svg)# hm
Command line history manager for bash.## About
History manager provides an alternative command line history storage with the ability to select a subset of commands and load it into the current Bash session so the Ctrlr search is performed on the selected subset. It has an [SQLite](https://www.sqlite.org) database under the hood and, besides the executed command line, stores time, working directory, returned code and a unique terminal session identifier. All additional information may be used as a selection criterion.## Motivation
There are two main usage scenarios:
### Recover history
It is a quite common issue when you need to repeat some actions with a previously developed project but don't remember exact commands you have used for it. History manager provides a way to recover command history related to the specific directory, particular session or both.
### Synchronize history
The recovery of a history can be assumed as synchronization between previously existed session and the current one. But it may be also useful to synchronize histories of several simultaneously opened terminal sessions so any executed command can be easily shared. History manager solves this by using the same command selection mechanism as for the history recovery case.
## Installation
History manager is available as a python package:
```Shell
pip install history-manager
```For other installation options please follow the [link](docs/installation.md)
## Configuration
At the configuration step the history manager generates configuration file with:
```Shell
hm-init
```
To enable `hm` in the current session execute:```Shell
. ~/.hm/configuration
```And modify `~/.bashrc` to enable `hm` by default in future sessions:
```Shell
echo ". ~/.hm/configuration" >> ~/.bashrc
```More details are [here](docs/configuration.md).
## Usage
### Per-directory history recovery
Recovering command history related to the specific directory is performed with:
```Shell
hm /path/of/interest
```
or for the current working directory:```Shell
hm .
```### Terminal session command history recovery
To set a terminal session name and to recover the command history related to this name run the following:
```Shell
hm -s "Session Name"
```To synchronize history with the database using the previously given name:
```Shell
hm -s
```More usage examples are [here](docs/usage.md).
## Acknowledgements
History manager utilizes the following thirdparty projects:
- [SQLite](https://www.sqlite.org) - SQL database
- [apathy](https://github.com/dlecocq/apathy) - header-only path manipulation library
- [clipp](https://github.com/muellan/clipp) - header-only arguments parsing library