Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by Alvar, Ask, Avinash Raj, Mateo_, guntbert Mar 3 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 at 7:14
    
Hey thanks, Avinash,Avtar for response, yes Avatar the link u provided is bang on !! thanks –  jagdish Mar 3 at 7:34
1  
@AvinashRaj its 2.6.32-38-generic –  jagdish Mar 3 at 7:38
    
Ubuntu 10.04 desktop version already reached End Of Life. –  Avinash Raj Mar 3 at 7:47

3 Answers 3

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.

share|improve this answer
1  
thanks rusty !! –  jagdish Mar 3 at 7:37

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.

share|improve this answer
    
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 at 7:37

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'
share|improve this answer

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