LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-13-2010, 01:20 AM   #1
rajesh1978
LQ Newbie
 
Registered: Jun 2010
Posts: 26

Rep: Reputation: 0
Wink Hot key for command look up


Hi,
I have typed so many commands in the command prompt.
like
$grep people &.tpd
$ls -ltr
$ cd ../..
$grep abc *.txt
$ls -ltr tt*
$cd /home
....

like this some 100 commands are executed.
suppose I want to use $grep people *.tpd again then I remember in the command prompt I write grep then use the pageup key from keyboard. and it will take me to all the grep commands that are previously executed.

But now it is not working (Redhat and suse 11.2)

is there any other way that I can go directly to all the grep commands one by one and select the perfect one to re-execute.

I do not want to grep the histroy. Just keystrok is what I am looking for
Thanks
 
Old 10-13-2010, 01:27 AM   #2
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Let us know if

Ctrl+r and grep works?
 
Old 10-13-2010, 01:27 AM   #3
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Let us know if

Ctrl+r and grep works?
 
Old 10-13-2010, 01:55 AM   #4
ionrivera
Member
 
Registered: May 2010
Distribution: Debian, RHEL, AIX, Solaris, HP-UX
Posts: 61

Rep: Reputation: 4
Yep!


ctr+r
(reverse-i-search)`': grep
ctr+r
 
Old 10-13-2010, 02:01 AM   #5
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Can you try the same thing on any other new version of same distribution on any different system
 
Old 10-13-2010, 01:01 PM   #6
rajesh1978
LQ Newbie
 
Registered: Jun 2010
Posts: 26

Original Poster
Rep: Reputation: 0
Thanks all

I used ctrl+r. But i reached the llast grep I have used. Then which combination I need to follow I did not know

As I told my commands are like below and I want to reach grep people *.tpd

$grep people *.tpd
$ls -ltr
$ cd ../..
$grep abc *.txt
$ls -ltr tt*
$cd /home
 
Old 10-13-2010, 01:15 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Just press Ctrl+r again ...
 
Old 10-13-2010, 01:29 PM   #8
rajesh1978
LQ Newbie
 
Registered: Jun 2010
Posts: 26

Original Poster
Rep: Reputation: 0
Great..
It worked as per my expectation

Thanks a lot
 
Old 10-13-2010, 01:31 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Another method going about this is to use history, and
history expansion ...
Code:
history | grep grep
The use the number it shows before the line you want:
Code:
!<hist_num>
to re-run it.


Cheers,
Tink
 
Old 10-13-2010, 01:32 PM   #10
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Hi,

hope your problem is solved .. so would you mind marking it SOLVED so that other users may be benefited if they come across the same problem in future.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hot key riple Linux - Newbie 2 03-13-2008 12:55 AM
KDE Lock Session Hot Key sadarax Linux - Software 2 11-14-2005 04:55 PM
Right click hot key in kde? doctor_sniff Linux - General 1 07-09-2005 12:20 PM
Hot-key to kill apps? sdat1333 Fedora 7 12-05-2004 12:12 AM
hot key launcher ? isthar brihihs Linux - Newbie 3 01-14-2004 05:37 AM


All times are GMT -5. The time now is 08:29 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration