I am a huge fan of maximizing productivity in the shell. I wrote these three articles a while ago: Bash emacs-like keyboard shortcuts: http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-s... Bash vi-like keyboard shortcuts: http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-shee... Definitive bash guide to command line history: http://www.catonmat.net/blog/the-definitive-guide-to-bash-co... And they all…
Bash Shortcuts For Maximum Productivity
41–50 of 58 posts
Re: Bash Shortcuts For Maximum Productivity
#42A note to Mac users: Instead of Alt, you must press escape key. For example, Esc+b moves the cursor backward one word in bash, but you'll probably want to use option instead, so check 'Use option as meta key' in Terminal's settings (under keyboard tab). But if it's not very handy, you can set 'option+left arrow' to move cursor one word backward. To do that, open Terminal's settings, go to keyboard and add a shortcut…
http://stackoverflow.com/questions/196357/making-iterm-to-tr...
I still don't like it since I am so used to hitting the Apple key in emacs, but it beats having to use Esc+
Re: Bash Shortcuts For Maximum Productivity
#43I am a huge fan of maximizing productivity in the shell. I wrote these three articles a while ago: Bash emacs-like keyboard shortcuts: http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-s... Bash vi-like keyboard shortcuts: http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-shee... Definitive bash guide to command line history: http://www.catonmat.net/blog/the-definitive-guide-to-bash-co... And they all…
Great articles. I'm just starting to get into the hang of vi. I'm giving vi-mode in bash a go (with "set -o vi") but there doesn't seem to be any indication of when I'm in command/insert mode. Is there any way to see this?
Re: Bash Shortcuts For Maximum Productivity
#44I use `..` to go upper directory, `...` to go up two levels, I added this to bashrc: str='..' level='./../' for i in `seq 1 10`; do eval "alias '$str=cd $level'" level=$level'../' str=$str'.' done Note, seq is not available in Mac, should use jot instead.
There's no need for seq or jot. In bash you can replace `seq 1 10` with {1..10}. Or {01..10} if you want zero padding when using $i to label files. I use an function called "up" that takes an optional integer argument to go up a certain number of levels. It won't necessarily be faster, but somehow I prefer it to typing lots of dots in a row: function up () { if test $# = 1 ; then s=$( printf "%$1s" ); s=${s// /..\/};…
Re: Bash Shortcuts For Maximum Productivity
#45I am a huge fan of maximizing productivity in the shell. I wrote these three articles a while ago: Bash emacs-like keyboard shortcuts: http://www.catonmat.net/blog/bash-emacs-editing-mode-cheat-s... Bash vi-like keyboard shortcuts: http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-shee... Definitive bash guide to command line history: http://www.catonmat.net/blog/the-definitive-guide-to-bash-co... And they all…
Great articles. I'm just starting to get into the hang of vi. I'm giving vi-mode in bash a go (with "set -o vi") but there doesn't seem to be any indication of when I'm in command/insert mode. Is there any way to see this?
Re: Bash Shortcuts For Maximum Productivity
#46Earlier quoted context omitted.
Comment it out (put a # at the front), unless your shell is set to ignore commented lines.
This works great! There is even a shortcut: M-#
Re: Bash Shortcuts For Maximum Productivity
#47That is, set -o vi
You can type that directly into your terminal for use just in one session or in your .bashrc
Type or just like in vim to escape into "command" mode. Most command mode commands work. E.g. '^' goes to the beginning of the line '$' goes to the end. 'i' sets bash back into insert mode.
Re: Bash Shortcuts For Maximum Productivity
#48Earlier quoted context omitted.
This works great! There is even a shortcut: M-#
You said copy-paste - are you using the OS copy-paste or readline's kill ring? C-a C-k is pretty fast, and then can be retrieved with C-y.
Re: Bash Shortcuts For Maximum Productivity
#49 ls /etc/pRe: Bash Shortcuts For Maximum Productivity
#50I'm a zsh user, but here's a couple of things I find pretty invaluable:- bindkey '^Q' push-line The 'push-line' widget allows you to quickly type another command and will restore the previous one once you've entered it. # re-run the previous command with sudo rerun-with-sudo () { LBUFFER="sudo !!" zle accept-line } zle -N rerun-with-sudo bindkey '^Xx' rerun-with-sudo Re-run the previous command prefixed with sudo by…