Being 2x Faster in the Terminal

Bash Jul 12, 2023

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.. → got python3 -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:

bash keyboard shortcuts - Linux - SS64.com

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.

ADM 3A — photo by Daniel Sancho

However, at least for me, the Emacs keybinding is more ergonomic and faster for typing than the modern keyboard.

Cheers

CODEMONDAY - Web App | Mobile App | Digital & IT Solution and Software Development Company
Realize your idea and ship it online. web application, website, mobile, Digital & IT Solution, desktop applications, e-commerce. Want your business to shine in the digital world? We are here to help.

Tags

TeamCMD

We are CODEMONDAY team and provide a variety of content about Business , technology, and Programming. Let's enjoy it with us.