1 |
> http://mywiki.wooledge.org/BashFAQ/088 |
2 |
|
3 |
The advice here to use awk to "compress" log files seems a bit dated. |
4 |
|
5 |
Bash now allows you to set in .bashrc: |
6 |
|
7 |
export HISTCONTROL=erasedups |
8 |
|
9 |
I don't know that there's an "ultimate answer" to history management. |
10 |
|
11 |
Personally, for years I have had my prompt set to show the history number of the current command, so I can look up on the screen and just enter !505 to reuse a previous comment. I reality, I never use this, but a terminal wouldn't feel like a terminal, for me now, without having numbered prompts up the screen. |
12 |
|
13 |
More practically I tend to use tmux and open new panes for each task or task group, keeping task sets short and closing the pane when I've done that little job (or sub-job). This allows Bash itself to manage its history more efficiently. |
14 |
|
15 |
If I need to use a previous command and ctrl-R doesn't easily find it, I tend to just `history | grep hint` to find it. |
16 |
|
17 |
I also set HISTSIZE and HISTFILESIZE to 900, so to maximise the number of previous commands available to me by typing only a three digit !321. |
18 |
|
19 |
Stroller. |