Question on bash command line

OS : RHEL / Oracle Linux 6.8

In bash shell, how can I replace a character under the cursor with another character ?

In the below example , after I typed the following line, I realized that I meant 7013 and not 2013. So I move the cursor to the left and keep it on top of 2 (of 2013) and I want to replace 2 with 7. How can I do that ?

$ echo hello world 2013

This question is not about replacing characters within vi/vim/emacs

A video example (for more clarity)
In the below video, how is this guy changing 2010 to 2011 instantly ? He also changes 2011 to 2012 , ... etc . I tried googling and I couldn't find anything on this. Hence posting it here.

Oracle Performance Tuning - Loading Data - 03 Using manual parallelism and changing initrans - YouTube

To use vi to edit your command line or navigate the

command history: set -o vi

To bring the previous command: k

To navigate by words on a command line: b

man vi for the options.

Ok. After I set set -o v i

how can I replace 2 which under the cursor with 7 ?

By issuing 's' over a character and typing a new number, followed by escape.

Regards
Peasant.

Surely to replace just the character under the cursor in vi mode you type 'r' followed by the new character.

Personally, I prefer the emacs mode. It is more intuitive (unlike emacs!)

In emacs mode, to change the character under the cursor, you use Ctrl-D to delete the character and type the new one.

Andrew

"I prefer editors one can use without being a professional pianist." [(c) bakunin @unix.com] :wink:

You move to the 0 , hit <Del Left> or <Ctrl-H>, and type 7 .

If you want to replace the char you're on, you'll have to switch bash 's readline library to "overwrite-mode". By default, this command is unbound, so you need to bind it, e.g.:

bind "\C-y":overwrite-mode

Thank You guys.
But none of the above solutions worked for me.