[clug] Favourite shell one liner
a.janke at gmail.com
Tue Dec 20 21:20:45 MST 2011
On 21 December 2011 14:14, Brendan Jurd <direvus at gmail.com> wrote:
> Substitutes the first 'foo' with 'bar' in the most recently entered
> command in your history, and then executes the result.
Ace stuff. (never had a clue on this one).
> Real world example:
> $ ls /path/to/file
> $ ^ls^vim
My current method to do this is (although $! is only the last argument):
$ ls ~/.basrc
$ vi !$
> Also good for correcting typos without having to fool around with
> arrow keys, or M-b and M-f.
$ head -3 ~/.inputrc
# !wimps use vi
set editing-mode vi
set keymap vi
Now Esc '-' and edit your C/L's to your hearts content.
More information about the linux