Being 2x Faster in the Terminal
We’re going to achieve the faster flow with ‘bash shortcut’.
I think it’s better by show you by an example of editing. Here below I edit the simple python one-liner server command.
What’s going on:
- Ctrl+R (reverse-i-search) → type
pyt..
→ gotpython3 -m http.server 9000
I = interactive. Search in command history. If the result is not what you’re looking for, you can continue the search by press Ctrl+R.
- Alt+F (go forward one word) → this skip the word
python3
(words are separated by a space, tab or delimiter like;
,
|
etc.)
Then I edit python3
to python2
- Ctrl+K (delete after cursor) → delete after where you have been typing
Then I just type SimpleHTTPServer
oops I forgot the -m
- Alt+B (go back one word) → go back one word
then I add -m
flag
- Ctrl+E (go to the last) → go to end of line
Then I add port 8000
I’ve just finished show you an example so I would like to delete this line by
- Ctrl+U (delete before cursor) → my cursor is at the end of line so now I delete the line (opposite to Ctrl+K delete after cursor)
finish
For the full list of bash shortcut, I would recommend this link on the great references SS64:
You might wonder why there are some key like:
e.g. Ctrl+h (delete char) → back space
at that time there are no arrow key on the keyboard.
However, at least for me, the Emacs keybinding is more ergonomic and faster for typing than the modern keyboard.
Cheers