I added +Jeff Dean just yesterday, and got this wonderful, wonderful reshare from +Matthew Might (also added, needless to say). This list is simply full of shiny, glittering pearls of pure win:

The very first tip, sudo !! , is guaranteed to save me countless of hours over time. It simply runs sudo, adding the previous command to it.

I always try to run "apt-get install" without sudo, it fails, then I have to go back and add "sudo" to the beginning of the command and redo it. This tip alone was more than worth looking through this list.


^foo^bar looks useful too: it reruns the previous command but replaces "foo" with "bar". Good for a long command with an annoying typo. Seems you can't use regular expressions in it, though. Use !!:gs/foo/bar/ for that. More cumbersome, but familiar to you if you know a bit of sed (which, really, you should take a look at some time)


Alt-. (that is, hold Alt, press '.') will cycle through the arguments you have used, starting with the most recent one. Handy! Example:

> ls really/long/boring/path/name/I/really/dont/want/to/retype
Then
> cd 'Alt-.'
Will become
> cd really/long/boring/path/name/I/really/dont/want/to/retype


My favourite: ctrl-x-e (that is, hold control, press x, press e) It takes the current line and drops you in your editor (vim in my case) where you can edit the whole long command line at your leisure. Save and exit and the command runs.

For someone like me who tends to use loops and other stuff on the command line this is a serious time saver. On the down side, I tend to write small ad-hoc shell script utilities once the command gets too long, but with this I may no longer bother. But those saved small scripts come in quite handy from time to time so I'm not sure this is a good thing.

Anyway, look through it; there's lots of gems in there.
Shared publiclyView activity