top | item 43482443

(no title)

curun1r | 11 months ago

Especially since it fits nicely into a mental model that includes !*, !^, !$, !-2 and such. ^something^somethingelse is also useful.

And the sudo !! pattern is something I do even when I realize that I need root ahead of time. There’s something about hitting enter on a command that makes me realize I’ve made a mistake, so doing that before I’ve granted root permissions is helpful. Up/ctrl-p are more awkward to use this way.

discuss

order

brigandish|11 months ago

I also like typing `!:` (in zsh) and hitting tab and getting some helpful hints:

    $ !:
    &  -- repeat substitution
    A  -- as ':a', then resolve symlinks
    P  -- realpath, resolve '..' physically
    Q  -- strip quotes
    a  -- absolute path, resolve '..' lexically
    c  -- PATH search for command
    e  -- leave only extension
    g  -- globally apply s or &
    h  -- head - strip trailing path element
    l  -- lower case all words
    p  -- print without executing
    q  -- quote to escape further substitutions
    r  -- root - strip suffix
    s  -- substitute string
    t  -- tail - strip directories
    u  -- upper case all words
    x  -- quote words, breaking on whitespace