VI Editor

Posted: August 7, 2013 in Uncategorized

* The vi editor is the default editor shipped with Redhat Linux
* For creating file under vi editor : vi filename
* For saving file: Esc + :w
* For quiting file: Esc + :q
* For foce quit : Esc + :q!
* For saving and quit: Esc + :wq
* For number line : Esc + :set nu
* For hide number line: Esc + :set nonu
* For moving to the nth no of line: Esc + :n
* For moving to the last line : Esc + shift + G
* For deleting line in command mode: dd
* For coping nline and pasting at the place of curser in command mode: nyy / p
* For undo : U
* :g/.*/m0     This will reverse the order of the lines in the current file
* :v/./d or :g/^$/d          Removes all blank lines.
* :g/^[ <ctrl-v><tab>]*$/d          Removes all lines that only have whitespace.
* :v/./$s/$/<ctrl-v><enter>./|”;/./-1j|$d   Replaces multiple blank lines with just one blank line.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s