help-gnu-utils
[Top][All Lists]
Advanced

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

Re: BASH history


From: Michael Elizabeth Chastain
Subject: Re: BASH history
Date: Wed, 5 May 2004 00:54:43 -0400 (EDT)

> ... to return the last command that started with ssh rather than the last
> command no matter what it was?

bash has a couple of feature for that.

  !ssh <RETURN>
    # repeats the last ssh command

  !ssh:p <RETURN>
    # prints the command and makes it the last command in the history,
    # without actually executing it.  You can see it and edit it.

  !?foo.net? <RETURN>
    # repeats the last command with foo.net anywhere in it

  !?foo.net?:p <RETURN>
    # prints the last foo.net command and makes it the last command
    # in this history, without actually executing it.

And some more:

  ^Rfoo.net
    # interactive search.  Type control-r, then type foo.net.
    # this will bring up the last command with foo.net and put you in
    # the line editor.  Type RETURN to accept the command, or mess
    # with the arrow keys, delete key, etc., to edit it.

There are a bunch of commands next to ^R but I haven't learned them yet.
do 'man bash' and look for reverse-search-history, there is a lot
of stuff there.

Michael C




reply via email to

[Prev in Thread] Current Thread [Next in Thread]