2013-12-25 22:25:36 +08:00
|
|
|
.TH HH 1
|
|
|
|
.SH NAME
|
2015-02-13 16:19:36 +08:00
|
|
|
\fBhh\fR \- easily view, navigate, sort and use your command history with shell history suggest box.
|
2013-12-25 22:25:36 +08:00
|
|
|
.SH SYNOPSIS
|
2015-09-18 12:51:17 +08:00
|
|
|
.B hh [option] [arg1] [arg2]...
|
|
|
|
.RS 0
|
|
|
|
.B hstr [option] [arg1] [arg2]...
|
2013-12-25 22:25:36 +08:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.B hh
|
|
|
|
uses shell history to provide suggest box like functionality
|
|
|
|
for commands used in the past. By default it parses .bash-history
|
|
|
|
file that is filtered as you type a command substring. Commands
|
|
|
|
are not just filtered, but also ordered by a ranking algorithm
|
2014-04-13 15:37:40 +08:00
|
|
|
that considers number of occurences, length and timestamp.
|
|
|
|
Favorite and frequently used commands can be bookmarked. In addition
|
2015-02-13 16:19:36 +08:00
|
|
|
\fBhh\fR allows removal of commands from history - for instance with a typo
|
2014-04-13 15:37:40 +08:00
|
|
|
or with a sensitive content.
|
2014-01-25 21:36:01 +08:00
|
|
|
.SH OPTIONS
|
2014-01-17 11:46:12 +08:00
|
|
|
.TP
|
2014-05-03 14:12:12 +08:00
|
|
|
\fB-h --help\fR
|
2014-01-28 04:12:17 +08:00
|
|
|
Show help
|
2014-04-05 05:31:29 +08:00
|
|
|
.TP
|
2014-05-03 14:12:12 +08:00
|
|
|
\fB-n --non-interactive\fR
|
2014-05-21 12:14:09 +08:00
|
|
|
Print filtered history on standard output and exit
|
2014-05-03 14:12:12 +08:00
|
|
|
.TP
|
2018-02-18 18:15:14 +08:00
|
|
|
\fB-k --kill-last-command\fR
|
|
|
|
Delete the last command from history and exit
|
|
|
|
.TP
|
2014-05-03 14:12:12 +08:00
|
|
|
\fB-f --favorites\fR
|
2014-04-13 15:37:40 +08:00
|
|
|
Show favorites view immediately
|
|
|
|
.TP
|
2014-05-03 14:12:12 +08:00
|
|
|
\fB-s --show-configuration\fR
|
2014-04-13 15:37:40 +08:00
|
|
|
Show configuration that can be added to ~/.bashrc
|
2014-01-28 04:12:17 +08:00
|
|
|
.TP
|
2015-05-28 05:00:21 +08:00
|
|
|
\fB-b --show-blacklist\fR
|
|
|
|
Show blacklist of commands to be filtered out before history processing
|
|
|
|
.TP
|
2014-05-03 14:12:12 +08:00
|
|
|
\fB-V --version\fR
|
2014-04-05 05:31:29 +08:00
|
|
|
Show version information
|
2014-04-13 15:37:40 +08:00
|
|
|
.SH KEYS
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2014-01-19 04:45:37 +08:00
|
|
|
\fBpattern\fR
|
2013-12-25 22:25:36 +08:00
|
|
|
Type to filter shell history.
|
2014-01-04 15:39:03 +08:00
|
|
|
.TP
|
2014-04-27 13:51:39 +08:00
|
|
|
\fBCtrl\-e\fR
|
2014-04-27 20:53:54 +08:00
|
|
|
Toggle regular expression and substring search.
|
2014-04-27 13:51:39 +08:00
|
|
|
.TP
|
2014-01-19 05:08:46 +08:00
|
|
|
\fBCtrl\-t\fR
|
2014-01-04 15:39:03 +08:00
|
|
|
Toggle case sensitive search.
|
2014-01-05 23:49:08 +08:00
|
|
|
.TP
|
2015-02-24 14:57:30 +08:00
|
|
|
\fBCtrl\-/\fR, \fBCtrl\-7\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Rotate view of history as provided by Bash, ranked history ordered by the number of occurences/length/timestamp and favorites.
|
2014-01-25 15:52:49 +08:00
|
|
|
.TP
|
2014-04-27 13:51:39 +08:00
|
|
|
\fBCtrl\-f\fR
|
|
|
|
Add currently selected command to favorites.
|
|
|
|
.TP
|
2014-01-25 15:52:49 +08:00
|
|
|
\fBCtrl\-l\fR
|
2015-01-26 16:01:24 +08:00
|
|
|
Make search pattern lowercase or uppercase.
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2017-05-13 22:43:53 +08:00
|
|
|
\fBCtrl\-r\fR, \fBUP\fR arrow, \fBDOWN\fR arrow, \fBCtrl\-n\fR, \fBCtrl\-p\fR, \fBCtrl\-j\fR, \fBCtrl\-k\fR
|
2014-01-07 14:19:10 +08:00
|
|
|
Navigate in the history list.
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2015-01-26 16:01:24 +08:00
|
|
|
\fBTAB\fR, \fBRIGHT\fR arrow
|
2014-01-19 04:45:37 +08:00
|
|
|
Choose currently selected item for completion and let user to edit it on the command prompt.
|
|
|
|
.TP
|
2015-01-26 16:01:24 +08:00
|
|
|
\fBLEFT\fR arrow
|
2015-02-28 15:45:46 +08:00
|
|
|
Choose currently selected item for completion and let user to edit it in editor (fix command).
|
2015-01-26 16:01:24 +08:00
|
|
|
.TP
|
2013-12-25 22:25:36 +08:00
|
|
|
\fBENTER\fR
|
2014-01-19 04:45:37 +08:00
|
|
|
Choose currently selected item for completion and execute it.
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2014-01-19 15:57:45 +08:00
|
|
|
\fBDEL\fR
|
2013-12-25 22:25:36 +08:00
|
|
|
Remove currently selected item from the shell history.
|
|
|
|
.TP
|
2017-04-29 10:40:50 +08:00
|
|
|
\fBBACKSPACE\fR, \fBCtrl\-h\fR
|
2014-01-25 21:36:01 +08:00
|
|
|
Delete last pattern character.
|
|
|
|
.TP
|
|
|
|
\fBCtrl\-u\fR, \fBCtrl\-w\fR
|
|
|
|
Delete pattern and search again.
|
|
|
|
.TP
|
2013-12-25 22:25:36 +08:00
|
|
|
\fBCtrl\-x\fR
|
|
|
|
Write changes to shell history and exit.
|
2014-01-19 04:45:37 +08:00
|
|
|
.TP
|
|
|
|
\fBCtrl\-g\fR
|
|
|
|
Exit with empty prompt.
|
2014-01-28 04:12:17 +08:00
|
|
|
.SH ENVIRONMENT VARIABLES
|
2015-01-08 06:23:49 +08:00
|
|
|
\fBhh\fR defines the following environment variables:
|
2014-01-28 04:12:17 +08:00
|
|
|
.TP
|
|
|
|
\fBHH_CONFIG\fR
|
2014-02-01 02:46:18 +08:00
|
|
|
Configuration options:
|
|
|
|
|
|
|
|
\fIhicolor\fR
|
|
|
|
Get more colors with this option (default is monochromatic).
|
|
|
|
|
2015-01-08 06:23:49 +08:00
|
|
|
\fImonochromatic\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Ensure black and white view.
|
2015-01-08 06:23:49 +08:00
|
|
|
|
2016-03-24 19:49:54 +08:00
|
|
|
\fIprompt-bottom\fR
|
|
|
|
Show prompt at the bottom of the screen (default is prompt at the top).
|
|
|
|
|
2018-01-03 19:40:20 +08:00
|
|
|
\fInoconfirm\fR
|
|
|
|
Do not ask for confirmation on a history entry delete (default is with confirmation).
|
|
|
|
|
2014-04-27 13:42:17 +08:00
|
|
|
\fIregexp\fR
|
2014-04-27 20:53:54 +08:00
|
|
|
Filter command history using regular expressions (substring match is default)
|
|
|
|
|
|
|
|
\fIsubstring\fR
|
|
|
|
Filter command history using substring.
|
2014-04-27 13:42:17 +08:00
|
|
|
|
2015-01-08 06:23:49 +08:00
|
|
|
\fIkeywords\fR
|
|
|
|
Filter command history using keywords - item matches if contains all keywords in pattern in any order.
|
|
|
|
|
2014-02-01 02:46:18 +08:00
|
|
|
\fIcasesensitive\fR
|
2014-04-27 20:53:54 +08:00
|
|
|
Make history filtering case sensitive (it's case insensitive by default).
|
2014-02-01 02:46:18 +08:00
|
|
|
|
|
|
|
\fIrawhistory\fR
|
2014-04-13 15:37:40 +08:00
|
|
|
Show normal history as a default view (metric-based view is shown otherwise).
|
|
|
|
|
2015-05-28 05:00:21 +08:00
|
|
|
\fIfavorites\fR
|
2014-04-13 15:37:40 +08:00
|
|
|
Show favorites as a default view (metric-based view is shown otherwise).
|
2014-02-01 02:46:18 +08:00
|
|
|
|
2015-12-30 06:21:40 +08:00
|
|
|
\fIduplicates\fR
|
|
|
|
Show duplicates in rawhistory (duplicates are discarded by default).
|
|
|
|
|
2018-02-21 15:40:14 +08:00
|
|
|
\fIverbose-kill\fR
|
|
|
|
Print the last command command deleted from history (nothing is printed by default).
|
|
|
|
|
2015-05-28 05:00:21 +08:00
|
|
|
\fIblacklist\fR
|
|
|
|
Load list of commands to skip when processing history from ~/.hh_blacklist (built-in blacklist used otherwise).
|
|
|
|
|
2017-06-11 20:44:09 +08:00
|
|
|
\fIkeep-page\fR
|
2017-06-11 20:32:50 +08:00
|
|
|
Don't clear page with command selection on exit (page is cleared by default).
|
|
|
|
|
2016-03-24 19:49:54 +08:00
|
|
|
\fIbig-keys-skip\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Skip big history entries i.e. very long lines (default).
|
2015-05-28 05:00:21 +08:00
|
|
|
|
2016-03-24 19:49:54 +08:00
|
|
|
\fIbig-keys-floor\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Use different sorting slot for big keys when building metrics-based view (big keys are skipped by default).
|
2015-05-28 05:00:21 +08:00
|
|
|
|
2016-03-24 19:49:54 +08:00
|
|
|
\fIbig-keys-exit\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Exit (fail) on presence of a big key in history (big keys are skipped by default).
|
|
|
|
|
2014-04-03 16:36:57 +08:00
|
|
|
\fIwarning\fR
|
|
|
|
Show warning.
|
|
|
|
|
|
|
|
\fIdebug\fR
|
|
|
|
Show debug information.
|
2014-02-01 02:46:18 +08:00
|
|
|
|
|
|
|
Example:
|
2015-01-08 06:23:49 +08:00
|
|
|
\fBexport HH_CONFIG=hicolor,regexp,rawhistory\fR
|
2014-02-01 02:46:18 +08:00
|
|
|
|
2015-01-08 05:15:21 +08:00
|
|
|
.TP
|
|
|
|
\fBHH_PROMPT\fR
|
2015-02-13 16:19:36 +08:00
|
|
|
Change prompt string which is \fBuser@host$\fR by default.
|
2015-01-08 05:15:21 +08:00
|
|
|
|
|
|
|
Example:
|
|
|
|
\fBexport HH_PROMPT="$ "\fR
|
|
|
|
|
2014-04-13 15:37:40 +08:00
|
|
|
.SH FILES
|
2015-05-28 05:00:21 +08:00
|
|
|
.TP
|
|
|
|
\fB~/.hh_favorites\fR
|
|
|
|
Bookmarked favorite commands.
|
|
|
|
.TP
|
|
|
|
\fB~/.hh_blacklist\fR
|
|
|
|
Command blacklist.
|
2014-04-13 15:37:40 +08:00
|
|
|
|
2015-02-13 16:19:36 +08:00
|
|
|
.SH BASH CONFIGURATION
|
2014-01-28 04:12:17 +08:00
|
|
|
Optionally add the following lines to ~/.bashrc:
|
2013-12-25 22:25:36 +08:00
|
|
|
.nf
|
|
|
|
.sp
|
2014-01-28 04:12:17 +08:00
|
|
|
export HH_CONFIG=hicolor # get more colors
|
2014-01-25 21:36:01 +08:00
|
|
|
shopt -s histappend # append new history items to .bash_history
|
|
|
|
export HISTCONTROL=ignorespace # leading space hides commands from history
|
|
|
|
export HISTFILESIZE=10000 # increase history file size (default is 500)
|
|
|
|
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
|
2013-12-25 22:25:36 +08:00
|
|
|
export PROMPT_COMMAND="history \-a; history \-n; ${PROMPT_COMMAND}"
|
2015-02-13 16:19:36 +08:00
|
|
|
# if this is interactive shell, then bind hh to Ctrl-r (for Vi mode check doc)
|
2016-09-27 14:45:36 +08:00
|
|
|
if [[ $\- =~ .*i.* ]]; then bind '"\eC\-r": "\eC\-a hh -- \eC-j"'; fi
|
2013-12-25 22:25:36 +08:00
|
|
|
.sp
|
|
|
|
.fi
|
2014-01-25 21:36:01 +08:00
|
|
|
The prompt command ensures synchronization of the history between BASH memory
|
|
|
|
and history file.
|
2015-02-13 16:19:36 +08:00
|
|
|
.SH ZSH CONFIGURATION
|
|
|
|
Optionally add the following lines to ~/.zshrc:
|
|
|
|
.nf
|
|
|
|
.sp
|
|
|
|
export HISTFILE=~/.zsh_history # ensure history file visibility
|
|
|
|
export HH_CONFIG=hicolor # get more colors
|
2016-09-27 14:45:36 +08:00
|
|
|
bindkey -s "\eC\-r" "\eeqhh\en" # bind hh to Ctrl-r (for Vi mode check doc, experiment with --)
|
2015-02-13 16:19:36 +08:00
|
|
|
.sp
|
|
|
|
.fi
|
2015-02-13 16:51:12 +08:00
|
|
|
.SH EXAMPLES
|
|
|
|
.TP
|
2015-02-28 15:45:46 +08:00
|
|
|
\fBhh git\fR
|
|
|
|
Start `hh` and show only history items containing 'git'.
|
|
|
|
.TP
|
2015-02-13 16:51:12 +08:00
|
|
|
\fBhh --non-interactive git\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Print history items containing 'git' to standard output and exit.
|
2015-02-13 16:51:12 +08:00
|
|
|
.TP
|
|
|
|
\fBhh --show-configuration >> ~/.bashrc\fR
|
2015-02-28 15:45:46 +08:00
|
|
|
Append default \fBhh\fR configuration to your Bash profile.
|
2015-05-28 05:00:21 +08:00
|
|
|
.TP
|
|
|
|
\fBhh --show-blacklist\fR
|
|
|
|
Show blacklist configured for history processing.
|
2013-12-25 22:25:36 +08:00
|
|
|
.SH AUTHOR
|
|
|
|
Written by Martin Dvorak <martin.dvorak@mindforger.com>
|
|
|
|
.SH BUGS
|
|
|
|
Report bugs to https://github.com/dvorka/hstr/issues
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR history (1),
|
2015-01-14 05:59:12 +08:00
|
|
|
.BR bash (1),
|
2015-09-18 12:51:17 +08:00
|
|
|
.BR zsh (1)
|