Linux/Unix is one of the most powerful operating system built, with the most loved Macintosh being built on it. The reason Linux is so powerful is that of the amazing terminal it provides with the commands which allow you to practically do everything. This time we are looking at some amazing yet simple commands to make you work faster on the vi editor.
.
Yes, you read it clear. The .(dot) in the shell is a command and it allows you to repeat the previous command. So, for example, if in the previous command you did x(another vi command) once you press ., you can repeat the command.
x
x cuts the current character. By cut, it means, if you type in p then the character deleted will be pasted. Let us see, how it does that –
We have created the following file –

x – This command in vi deletes the current character i.e. the one in which the cursor is present.
X – This command deletes the previous character from where the cursor is present.
So, if in the line is like this –
I am an amazing person.
Now, if the cursor is at n, in case you type x it deletes n. In case you type X, it deletes i.
Shift + G/g
Well, shift + G is no command. So, yes shift +G will not do anything. However, shift + g, takes you to the first character of the last line.
Shift + A/a
This again has no significance. But, shift + a takes you to the last character of the line you are at.

Leave a comment