1HH(1) General Commands Manual HH(1)
2
3
4
6 hh - easily view, navigate, sort and use your command history with
7 shell history suggest box.
8
10 hh [option] [arg1] [arg2]...
11 hstr [option] [arg1] [arg2]...
12
14 hh uses shell history to provide suggest box like functionality for
15 commands used in the past. By default it parses .bash-history file that
16 is filtered as you type a command substring. Commands are not just fil‐
17 tered, but also ordered by a ranking algorithm that considers number of
18 occurences, length and timestamp. Favorite and frequently used com‐
19 mands can be bookmarked. In addition hh allows removal of commands from
20 history - for instance with a typo or with a sensitive content.
21
23 -h --help
24 Show help
25
26 -n --non-interactive
27 Print filtered history on standard output and exit
28
29 -f --favorites
30 Show favorites view immediately
31
32 -s --show-configuration
33 Show configuration that can be added to ~/.bashrc
34
35 -b --show-blacklist
36 Show blacklist of commands to be filtered out before history
37 processing
38
39 -V --version
40 Show version information
41
43 pattern
44 Type to filter shell history.
45
46 Ctrl-e Toggle regular expression and substring search.
47
48 Ctrl-t Toggle case sensitive search.
49
50 Ctrl-/, Ctrl-7
51 Rotate view of history as provided by Bash, ranked history
52 ordered by the number of occurences/length/timestamp and
53 favorites.
54
55 Ctrl-f Add currently selected command to favorites.
56
57 Ctrl-l Make search pattern lowercase or uppercase.
58
59 Ctrl-r, UP arrow, DOWN arrow, Ctrl-n, Ctrl-p
60 Navigate in the history list.
61
62 TAB, RIGHT arrow
63 Choose currently selected item for completion and let user to
64 edit it on the command prompt.
65
66 LEFT arrow
67 Choose currently selected item for completion and let user to
68 edit it in editor (fix command).
69
70 ENTER Choose currently selected item for completion and execute it.
71
72 DEL Remove currently selected item from the shell history.
73
74 BACSKSPACE, Ctrl-h
75 Delete last pattern character.
76
77 Ctrl-u, Ctrl-w
78 Delete pattern and search again.
79
80 Ctrl-x Write changes to shell history and exit.
81
82 Ctrl-g Exit with empty prompt.
83
85 hh defines the following environment variables:
86
87 HH_CONFIG
88 Configuration options:
89
90 hicolor
91 Get more colors with this option (default is monochro‐
92 matic).
93
94 monochromatic
95 Ensure black and white view.
96
97 prompt-bottom
98 Show prompt at the bottom of the screen (default is
99 prompt at the top).
100
101 regexp
102 Filter command history using regular expressions (sub‐
103 string match is default)
104
105 substring
106 Filter command history using substring.
107
108 keywords
109 Filter command history using keywords - item matches if
110 contains all keywords in pattern in any order.
111
112 casesensitive
113 Make history filtering case sensitive (it's case insen‐
114 sitive by default).
115
116 rawhistory
117 Show normal history as a default view (metric-based view
118 is shown otherwise).
119
120 favorites
121 Show favorites as a default view (metric-based view is
122 shown otherwise).
123
124 duplicates
125 Show duplicates in rawhistory (duplicates are discarded
126 by default).
127
128 blacklist
129 Load list of commands to skip when processing history
130 from ~/.hh_blacklist (built-in blacklist used otherwise).
131
132 big-keys-skip
133 Skip big history entries i.e. very long lines (default).
134
135 big-keys-floor
136 Use different sorting slot for big keys when building
137 metrics-based view (big keys are skipped by default).
138
139 big-keys-exit
140 Exit (fail) on presence of a big key in history (big
141 keys are skipped by default).
142
143 warning
144 Show warning.
145
146 debug
147 Show debug information.
148
149 Example:
150 export HH_CONFIG=hicolor,regexp,rawhistory
151
152
153 HH_PROMPT
154 Change prompt string which is user@host$ by default.
155
156 Example:
157 export HH_PROMPT="$ "
158
159
161 ~/.hh_favorites
162 Bookmarked favorite commands.
163
164 ~/.hh_blacklist
165 Command blacklist.
166
167
169 Optionally add the following lines to ~/.bashrc:
170
171 export HH_CONFIG=hicolor # get more colors
172 shopt -s histappend # append new history items to .bash_history
173 export HISTCONTROL=ignorespace # leading space hides commands from history
174 export HISTFILESIZE=10000 # increase history file size (default is 500)
175 export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
176 export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
177 # if this is interactive shell, then bind hh to Ctrl-r (for Vi mode check doc)
178 if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh -- \C-j"'; fi
179
180 The prompt command ensures synchronization of the history between BASH
181 memory and history file.
182
184 Optionally add the following lines to ~/.zshrc:
185
186 export HISTFILE=~/.zsh_history # ensure history file visibility
187 export HH_CONFIG=hicolor # get more colors
188 bindkey -s "\C-r" "\eqhh\n" # bind hh to Ctrl-r (for Vi mode check doc, experiment with --)
189
190
192 hh git
193 Start `hh` and show only history items containing 'git'.
194
195 hh --non-interactive git
196 Print history items containing 'git' to standard output and
197 exit.
198
199 hh --show-configuration >> ~/.bashrc
200 Append default hh configuration to your Bash profile.
201
202 hh --show-blacklist
203 Show blacklist configured for history processing.
204
206 Written by Martin Dvorak <martin.dvorak@mindforger.com>
207
209 Report bugs to https://github.com/dvorka/hstr/issues
210
212 history(1), bash(1), zsh(1)
213
214
215
216 HH(1)