3

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.

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

3 Answers 3

7

tab-completion:

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).

reverse-i-search:

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.

0
2

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'
1

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.

1
  • 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, 2014 at 7:37

Not the answer you're looking for? Browse other questions tagged .