https://github.com/psmths/history-quickrun
Quickly find and run past commands from bash history
https://github.com/psmths/history-quickrun
bash command-line-tool terminal-app
Last synced: 2 months ago
JSON representation
Quickly find and run past commands from bash history
- Host: GitHub
- URL: https://github.com/psmths/history-quickrun
- Owner: Psmths
- License: gpl-2.0
- Created: 2020-08-28T17:12:26.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-31T01:11:37.000Z (almost 6 years ago)
- Last Synced: 2025-03-06T17:50:37.508Z (over 1 year ago)
- Topics: bash, command-line-tool, terminal-app
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# history-quickrun
Quickly find and run past commands from bash history. This is a python script that will take user input and use regular expressions to match it to commands found in your bash history. It will then return an enumerated list of the commands it found and allow you to run the one you were looking for instead of abusing the up arrow key.
# Usage
```
./hr 'partial command'
```
The input argument being a regex can be used to search for multiple commands:
```
./hr 'sys|echo'
```
Additionally, the script allows you to run a chain of commands successively by entering a comma separated list of indices such as 3,7,13.
It should be noted that the current shell session history is stored in memory, whereas this program reads from a history file. In order to update the history when the command is run you may consider setting an appropriate alias such as:
```
alias h='history -a; hr $1'
```
# Example
