[CentOS] reuse the history

Jim Wildman jim at rossberry.com
Fri Oct 17 18:13:41 UTC 2008


On Fri, 17 Oct 2008, ann kok wrote:

> Which command I can only select "traceroute 192.168.0.5" to run?
>
> $ history |grep traceroute
>   26  traceroute 192.168.0.5
>   27  traceroute -n 192.168.0.5
>   28  traceroute 192.168.0.10
>   29  traceroute yahoo.com
>   46  traceroute 192.168.0.33
>
>
csh history

!26

or !26:s/168/122/ to change it

or 
!trac

to get #46 (or the last command to have trac at the start_

!?trace
to run the last command with trace anywhere in the cmdline

fc

to invoke your $EDITOR on the last command

also
!-2 
(next to last)

etc


----------------------------------------------------------------------
Jim Wildman, CISSP, RHCE       jim at rossberry.com http://www.rossberry.com
"Society in every state is a blessing, but Government, even in its best
state, is a necessary evil; in its worst state, an intolerable one."
Thomas Paine


More information about the CentOS mailing list