4 ms·
I think more can be saved by learning to use the shell (e.g. bash) better. For instance, since the shell has command history that persists between sessions, on
by unwind 15y ago
I think more can be saved by learning to use the shell (e.g. bash) better.
For instance, since the shell has command history that persists between sessions, once you've run e.g. "git push" once, you can run it again by typing e.g. "^R pu" (including the space to make it more unique). That's more keypresses than just "gp", but way clearer and more portable since it will work wherever you have Bash, not just where your particular aliases are installed.
- senko 15y agoInteractive history search (^R) in Bash (and IPython) so awesome, it can't be overstated. I've become so addicted to it that I start almost any command with ^R now. For most of them, I've got them somewhere in history - and only if it doesn't find anything, I ^C and type manually.
- tednaleid 15y agoI use shell history all the time, but I don't personally find it useful to use for really common operations. I agree with the OP that commands that you execute 10's or 100's of times a day should be made as short as possible and they'll be part of muscle memory. You can't rely on muscle memory for history commands as you always need to pause and verify that history found what you were expecting it to find. If your history looked like this (real shell history for me): git push ssh ec2-75-101-198-99.compute-1.amazonaws.com the ^R would find the ssh command first, so you can't trust that "^Rpu" will always find the command so muscle memory can't set in and will slow you down
- bcl 15y agoI love ^R But make sure you've found the command you really thought you were looking for before mashing the return key. Sometimes my muscle memory is a bit too fast...
- pkrumins 15y agoIf you love ^R, you'll also love http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/ http://www.catonmat.net/blog/the-definitive-guide-to-bash-co...
- jacobr 15y ago"\e[A": history-search-backward "\e[B": history-search-forward In .inputrc lets me just start typing a command and then press the up arrow to search the history, no need for ^R.
- vilya 15y agoYou can define custom auto-completions for bash as well. If you're running Ubuntu, it ships with a default set of auto-completions that cover git, svn and cvs commands. Try it for yourself: type "git stat<Tab>" and it'll autocomplete to "git status".