12 comments

[ 5.6 ms ] story [ 48.3 ms ] thread
Ctrl-X E didn't work for me. Anyone know what shell that's for? (I'm using bash.)
That was bash, Try Cntrl-X Cntrl-E instead.
Watching Star Wars via telnet... I've been looking for that command for ages.
Within the past year I discovered dig's +short parameter, which let me retire some scripts I had for parsing just the IPs out of dig's output. e.g.:

dig +short google.com

Ctrl+r instead of history | grep
The "@" command is pretty useful too, for doing arithmetic on shell variables.

    % set i = 1
    % echo $i
    1
    % @ i++
    % echo $i
    2
    % @ i *= 2
    % echo $i
    4
Which shell? (@ is not in my bash version, nor spaces around the = sign.)
Bad example:

    $ ls -l 500.*
    $ ^500^600
Fewer keystrokes (using bash):

    $ ls -l 500.*
    Up-arrow, control-left, delete, 6
My favorite bash trick is still Ctrl-O: submit command and advance history by one.

If you ever find yourself counting up-arrows to repeat a sequence of commands (that aren't worth scripting for whatever reason), next time, go to the top of the list and hit Ctrl-O. The result is the the command runs, and the one after it in the history is loaded into you prompt.