This question already has an answer here:

I had done this previously but now I don't remember the trick, Something like when you type in command in terminal it should auto complete it by matching it with the similar commands given in History, so Up Arrow would show me matching history commands instead of plain old previous irrelevant commands.

marked as duplicate by Alvar, Maythux, Avinash Raj, Mateo, user117103 Mar 3 '14 at 21:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What's the output of uname -r? – Avinash Raj Mar 3 '14 at 7:14
  • Hey thanks, Avinash,Avtar for response, yes Avatar the link u provided is bang on !! thanks – jagdish Mar 3 '14 at 7:34
  • 1
    @AvinashRaj its 2.6.32-38-generic – jagdish Mar 3 '14 at 7:38
  • Ubuntu 10.04 desktop version already reached End Of Life. – Avinash Raj Mar 3 '14 at 7:47


You can use tab-completion to complete the command, options, etc. e.g. type fi and hit Tab twice in quick succession, the list of available completions will be shown (if more than one command begins with the text fragment you typed in), then with fin typed press Tab it would complete it with find (if this is the only match).


Ctrl+R will smartly look from the history and display the matching ones. e.g. pressing Ctrl+R in terminal and typing su resulted in:

(reverse-i-search)`su':  sudo restart lightdm

if that's not the right one you can type further till the right most recent matching command is displayed.


Add this to .bash_profile and source it:

# make bash autocomplete with up arrow
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

# make tab cycle through commands instead of listing
bind '"\t":menu-complete'

you use ctrl + r when you are in the terminal and start typing som letters from the comand you want to have, when you have press enter or right arrow.

  • thanks simon, it works, but I find editing PageUp and PageDown response in /etc/inputrc is quicker than this !! what you say :) – jagdish Mar 3 '14 at 7:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.