LinuxQuestions.org
Visit Jeremy's Blog.
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, 11: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, 12:45 PM   #2
320mb
Senior Member
 
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577

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

~/.bash_history

you can create your own keyboard shortcut to it............
 
Old 10-15-2004, 01: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, 03:10 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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, 03: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, 04:09 PM   #6
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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, 04: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, 04:25 PM   #8
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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 04:58 PM
bash history slowly Linux - General 2 11-12-2004 12:35 PM
Bash History ukndoit Linux - Security 2 10-16-2003 10:02 AM
Wiping bash command history? skewer Linux - General 3 07-30-2003 03:33 PM
bash command history problem crabboy Slackware 1 10-17-2002 08:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:22 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration