[sf-lug] My favorite simple little Linux tips

Jesse Zbikowski embeddedlinuxguy at gmail.com
Wed Aug 4 15:54:07 PDT 2010


On Fri, Jul 30, 2010 at 9:05 PM, Akkana Peck <akkana at shallowsky.com> wrote:
> $ !-4:gs/foo/bar
>
> runs the fourth-to-last command, replacing every foo with bar
> (gs means global substitute).

That's pretty cool. I was afraid to use history expansion until I discovered

$ shopt -s histverify

(setopt histverify in Zsh). This lets you see and edit the expanded
command before hitting enter; useful for when you accidentally type

$ rm -rf junk
$ !!:s/junk/*




More information about the sf-lug mailing list