I had a good time thinking of creating a series of weekly posts that contain exclusive information about the terminal, bash, vim, commands, bash script, whatever is written in the console 🙂 but always for different reasons I could not create it, but today I decided. So here is the first terminal Friday entry. I hope someone finds it useful.
Table of Contents
Editing on the command line
Many of us use the terminal in a usual way, but we are not aware of its full potential, so a couple of months ago, I took on the task of collecting the shortcuts of bash from the most usual like cleaning bash, to changing the order of the last two characters, or the order of the last two arguments.
These shortcuts are very similar to the ones you use Emacs of course this is because bash is developed by GNU but it is possible to change the settings to Vi / Vim style by typing the following command.
$ set -o vi
How to read:
C: Left Ctrl.
M: Meta, usually Left Alt.
Cx Cu: Press Ctrl and without releasing press x then u and release Ctrl.
Now I will write the few that I know:
Cb: You move back one character.
Cf: You move one character forward.
C-_ "or" Cx Cu: Undo the last edit of the command.
Cl: Clean the screen.
Cu: Delete the entered line.
DC: Cancel the current running command.
Ch: Delete one character backwards.
CD: Delete one character forward.
Ck: Delete the text from the cursor position to the end of the line.
Md: Deletes the text from the cursor position to the end of the current word.
Cw: Deletes the text from the cursor position to the beginning of the current word.
M-Backspace: Deletes the text from the cursor position to the beginning of the current word.
AC: Place the cursor at the beginning of the line.
EC: Place the cursor at the end of the line.
Mf: Place the cursor one word in front.
Mb: Move the cursor one word back.
Cr: Search through the history.
Up and down: Browse the history.
Ct: Change the order of the last two characters.
Esc-t: Change the order of the last two words.
Tab: Auto-complete commands, routes, files, etc ...
Cy: Yank * the recently deleted text
* Yank is literally copying
Editor's note: Due to time constraints the article could not be published on Friday. We apologize for this.