Re: looking for a BASH tool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/27/2016 07:56 AM, Chris Adams wrote:
> Once upon a time, SternData <subscribed-lists@xxxxxxxxxxxxx> said:
>> Years ago, I used a tool called CED and PCED on DOS systems.  I could
>> type in "abc" and press an up-arrow and it would walk back through my
>> stack of DOS commands showing only those with "abc" in them.
>>
>> There's *got* to be a similar tool for bash, but my google-fu is weak today.
> 
> control-R is bound to reverse-search-history by default.  That will
> search anywhere in previous commands, so for example typing "s" followed
> by ^R would show matches for "ls".
> 
> If instead you want to search for commands with the same start (so just
> typing "s" would only show commands that started with "s"), you want
> history-search-backward, which is bound to PageUp on Fedora (not bound
> by default upstream IIRC).
> 
I use the following in bashrc

if [ "$PS1" ]; then                                                                                                                                  
  bind '"\e[A"':history-search-backward                                                                                                              
  bind '"\e[B"':history-search-forward                                                                                                               
  bind '"\e[23~"':"\"\C-k\C-ahistory | grep '^ *[0-9]* *\C-e.'\C-m\""                                                                                
  bind '"\e[24~"':kill-whole-line                                                                                                                    
  bind Space:magic-space                                                                                                                             
  shopt -s histappend                                                                                                                                
  export PROMPT_COMMAND='history -a'                                                                                                                 
if

This privides the same functionality you mentioned for windows plus: F12 erases the current command line without executing it, F11 will show the entire history of commands that start with any character typed on the command line before pressing F11.

The shopt part is supposed to insure that each new command line executed is saved immediately in the history file, instead of when the shell is closed.

Emmett
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux