Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash Shell - What is equivalent of DOS shell F8?

Tags:

linux

bash

When working an interactive bash session, one aspect from the Windows shell I miss is the F8 key where you start typing a command, hit F8 and the shell finds the most recent command entered in history that matches what you have typed so far. e.g.

me@Ubntu07:~>cd /home/jb<F8 Key Here>

brings up my prior command:

me@Ubntu07:~>cd /home/jboss/server/default/log

Is there any way to do this in bash ?

like image 780
Nicholas Avatar asked Jan 08 '09 14:01

Nicholas


2 Answers

I have these lines in my .inputrc file:

"\e[A": history-search-backward
"\e[B": history-search-forward

This binds history search to the up and down arrow keys. So you can start typing a command, kextload say, and then each tap of the up arrow will complete the line with the previous command that started with kextload.

All of my config files are public on github.

http://github.com/jonshea/config-files/tree/master

like image 114
Jon Shea Avatar answered Nov 03 '22 10:11

Jon Shea


If you use vi input mode (set -o vi in bash or via set editing-mode vi in .inputrc), you can use normal vi commands to search the history (/). This gives you full regular expressions, too, which can be helpful for finding a complex command.

like image 24
Hudson Avatar answered Nov 03 '22 09:11

Hudson