LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-15-2004, 10:53 AM   #1
titanandrews
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Rep: Reputation: 0
F8 for command history in bash


Hi all,

In Windows command prompt, I can type a word and hit F8 to iterate the history of that word. For example, if I type "java ThisProgram" and then later type "java "ThatProgram" I can just enter "java" and hit F8 and it will cycle through those 2 entries and complete the statements on the command line.

I was wondering if there is anything like this in the bash shell on Linux. I know about up/down arrow keys and this is useful, but I am very used to F8.


many thanks,

Barry
 
Old 10-15-2004, 11:45 AM   #2
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

Rep: Reputation: 47
in the ~/home directory is a hidden file..........

~/.bash_history

you can create your own keyboard shortcut to it............
 
Old 10-15-2004, 12:56 PM   #3
titanandrews
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
But how will creating a keyboard shortcut to a file help?
 
Old 10-15-2004, 02:10 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
I think Ctrl r might be what you have in mind.

For example....
If I run these commands.
cd /home/stuff
ls -al
cd /root
ls -l
cd /mnt/tech
ls -r

then I can use the command: Ctrl r
and if I type l it comes up with the last command which started with l
pressing the Ctrl r again finds the previous command which started with l
.....
 
Old 10-15-2004, 02:56 PM   #5
titanandrews
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Hmmmm... Well that functionality is what I am looking for, but when I do CTRL-R I get a message, "(reverse-i-search)" What am I missing? Do I need a key mapping or something?

thanks,

Barry
 
Old 10-15-2004, 03:09 PM   #6
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
After you do Ctrl r then you type in the search word or even just part of it and the reverse search will find the last instance of that word or letter. Pressing Ctrl r again finds the next previous instance of that word or letter.
 
Old 10-15-2004, 03:23 PM   #7
titanandrews
LQ Newbie
 
Registered: Oct 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Got it! Cool! Thanks a lot homey!
 
Old 10-15-2004, 03:25 PM   #8
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
You're welcome.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash history file jinksys Linux - Software 2 07-30-2005 03:58 PM
bash history slowly Linux - General 2 11-12-2004 11:35 AM
Bash History ukndoit Linux - Security 2 10-16-2003 09:02 AM
Wiping bash command history? skewer Linux - General 3 07-30-2003 02:33 PM
bash command history problem crabboy Slackware 1 10-17-2002 07:55 PM


All times are GMT -5. The time now is 12:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration