Edit configuration files faster ever using vi and vim RHCSA





______________________

Text Editores

______________________



Syntax: vi <FileName>

#vi FileName



Insert Mode: You can able to Insert/Write the Data to the Text file.

Command Mode: You can able to copy the text/Delete the text Paste.

EX-Mode: Execute commands, Write/Exit



-------------------------

Command Mode shortcut

-------------------------

command mode is default mode to execute text manupalation commands

dd = Delete Line

d5d - will delete 5 lines

5dd - will delete  lines

x = Delete Character

nx - delete n characters (Ex. 6x deletes SIX characters)

yy = copy line

y6y - it will copy SIX lines to below

6yy - it will copy SIX lines to below



p = Paste copied lines below the cursor

P = Paste copied line above the cursor

dw = delete single word

u - undo the last action

J - join the line

. - redo

U - undo all changes to the current Line

w - will move to the begining of the next word

nw - will move to nth word begning

b - will move begining of the previous word

nb - will move begining of nth previous words

{ - move backword one paragraph

} - move forward one paragraph

0 - will go to home position

$ - will go to end of the line position







h <--  using h key we can go from right to left direction

l --> using l key we can go from left to right direction

k ^ using k key we can go UP from down

j -- Using j key we can go Down from UP



Shift +G == go to Last line of the file

Shift+h == go to first line of screen

Shift+z == Save & Quit

n = Search Strings from top to bottom

N = Search from bottom to top



%s/Old/New  == Replace content from old to new

/StringName == Search Particular Word in the file.





-----------------

Insert Mode

-----------------

i = Insert Data before the cursor position

I = Insert content starting of the Line

a = It will append current Line characters

A = It will append the characters from end of the Line

o = It will insert a new line below the cursor

O = It will insert a new line above the cursor

s = substitute the  stream

r = replace the current character



'home' key to go home of the line

'end' key to go end of the line



------------------

Ex-Mode Shortcut

------------------



Esc key to change the mode to Execute mode

:q = Quit file

:w = write file

:wq = Save& quit.

:q! = quit forcefully

:wq! = Save & Exit forcefully

:1 == go to first line of the File

:set nu == Set the line numbers

:set nonu == Remove Line numbers

:<spesify line number> == Specified Line number.

:r /root/test = copy the content of test file in cursor current position

:r !date = the command output will paste in current cursor position





____________________________

nano Text Editor

____________________________



CTRL+g Or F1 = Help

CTRL+x Or F2 = Save File

CTRL+o Or F3 = Write to file to disk

CTRL+j Or F4 = To justify

CTRL+r Or F5 = To insert file text to cursor current position

CTRL+w Or F6 = Search for string

CTRL+y Or F7 = Move to previous screen

CTRL+v Or F8 = Move to the Next Screen

CTRL+k Or F9 = Cut the current and keep into buffer

CTRL+v Or F10 = Uncut/Paste into current file

CTRL+c Or F11 = Display the position of the cursor



CTRL+SHIFT+G = Go to mentioned Line


No comments:

Post a Comment