Hacker News new | past | comments | ask | show | jobs | submit login

Instead of searching through history, you can add this to your .inputrc

  "\e[B": history-search-forward
  "\e[A": history-search-backward
And this to your .bash_proflie

  export HISTCONTROL=erasedups
  export HISTSIZE=100000
  shopt -s histappend
Now the up/down arrow keys auto search and complete backwards/forwards based on what's written. If the line is empty, it behaves as normal.

This is also pretty neat, in your .bash_proflie:

  bind '"\t":menu-complete'
Enables cyclic tab completion

These are the first things I do when I'm on another terminal.




Cool, thanks for the cyclic tab. That was a new one for me.

I've been using the remap of the up/down arrow for a while too, and it is crazily useful indeed. It's the first thing I do on a new terminal. That, together with adjusting PS1 and setting up my common aliases.


Absolutely love both of these, thank you so much. My only nitpick would be that when you have text typed, say '$ vim' and go up, finding '$vim somefile', then going down again should bring you back to what you originally typed. This is also the behaviour in vim, I believe.

Any other tips? These two were brilliant!


Regarding HISTFILESIZE the man page for bash says:

> When this variable is assigned a value, the history file is truncated

Which I read as meaning if you export the following then you should get infinite entries:

  export HISTFILESIZE=
I'm testing to see if it works for this also:

  export HISTSIZE=




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: