Terminal Friday: Command Line Editing

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.

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.

PortThese 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.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

16 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   templix said

    Let no one think of:

    $ set -o vi

    hahahahahaaa ... I saw it for Poor Clare sisters ... hahahajjajaaa

  2.   Giskard said

    My keyboard has some very comfortable arrows. I press left arrow and the cursor moves to the left. I press HOME and the cursor goes home. And I could go on. My keyboard is very intuitive. And all programs recognize it. It must be magic 😛
    That's why I don't like it and I'll never like it vi * By keeping a keyboard layout from when keyboards were less than 80 keys. Back in the 70's it seems to me. By now they should AT LEAST have incorporated the cursor movement keys that come on ALL keyboards and that's it. What a hassle to have to learn Ctrl + this and Ctrl + that for something that should be INTUITIVE.
    It is my opinion. Regards.

    1.    templix said

      Nobody prevents you from using the keys you mention, what's more, vi or emacs allow you to use without problems both the keys of current keyboards as those that were used in prehistory, but with the shortcuts of these editors you have a lot more options than the few "intuitive" keys that any keyboard offers. Anyway, if you are enough with these four keys and left over for your daily chores, you do very well not to mess with these rolls that are vi or emacs ... you could discover things belonging to parallel universes that could trap you forever and ever ...

      1.    eliotime3000 said

        Well, these sorts of Vi or EMACS commands are really useful if you're editing code from netbooks (themselves the most awkward keyboards I've used so far).

    2.    rawBasic said

      The shortcuts of the Ctrl + M + style, are in the style of emacs and other GNU tools .. .. they are not like that in vi .. it says in the same article ..

      vi turns out to be a very intuitive tool, for those who want to learn how to use it..at some point you learned to use the keyboard when it was not intuitive, the same with a mouse .. ..that's why it can no longer be intuitive to use vi or a dvorak keyboard for other people .. 😉

    3.    SnKisuke said

      Sorry but vi and emacs have those keyboard configurations because there are really old servers and workstations still running that have different types of unix, also not all modern servers have 101-key keyboards some only have the basics to be able to modify a file ( give thanks that it has esc, ctrl, alt, and shift), and that's where vi's keyboard shortcuts save you. Not to mention that in some unixes there is only vi, not emacs, no nano, no etc, and much less one with a graphical interface, I do not like either saw or emacs, but in my work it is essential to know those shortcuts since I do not I know what type of server I'm going to have to manage, I saw it is the default in 99% of the unixes. Cheers

      1.    ezitoc said

        Having everything at your fingertips without having to move your hands is why the hjkl system is used. I do not know if it will be due to old servers and how technology advances today makes me doubt that this is the cause. Regards.

  3.   eliotime3000 said

    Nice try, but I'm still in Emacs.

    1.    Giskard said


  4.   Joaquin said

    Very good! especially the first image.

  5.   Mario Guillermo Zavala Silva said

    Apologies Accepted ... Although we hope that this July 18 we will have that excellent information.


  6.   amulet_linux said

    Very interesting, I only knew the basics

  7.   oscar said

    Very good, just one thing: It is Press with 'S', it does not press ... TT

    1.    Wada said

      Hahahaha you are right brother excuse me I passed the correction in Vim
      ps There will be that horror for a while, I can not edit the post 😀 but thanks for the observation I will be more thorough in the next 🙂

  8.   ahdezzz said

    Hello, I am delighted with the Vi mode; however, I would like to know if there is any way to know what mode I am in, something like a graphical indicator. Greetings and thanks in advance.

    1.    Wada said

      I was trying to create a script but I couldn't, as I don't have much free time these days but I promise that when I find a solution I will publish it 😀